From patchwork Fri Jan 17 18:26:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Cartwright X-Patchwork-Id: 3506811 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6A9AAC02DC for ; Fri, 17 Jan 2014 18:30:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D8AF2015D for ; Fri, 17 Jan 2014 18:30:22 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AFCD2014A for ; Fri, 17 Jan 2014 18:30:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W4EBG-0006Py-Cs; Fri, 17 Jan 2014 18:30:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W4EBD-0001yi-Vf; Fri, 17 Jan 2014 18:30:08 +0000 Received: from smtp.codeaurora.org ([198.145.11.231]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W4EBA-0001xH-8Z for linux-arm-kernel@lists.infradead.org; Fri, 17 Jan 2014 18:30:05 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id ED08513EF4D; Fri, 17 Jan 2014 18:29:42 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id DF89F13EFFA; Fri, 17 Jan 2014 18:29:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from joshc.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com [67.52.129.61]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: joshc@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 24E3813EF4D; Fri, 17 Jan 2014 18:29:42 +0000 (UTC) Received: by joshc.qualcomm.com (Postfix, from userid 1000) id 1C894613FB; Fri, 17 Jan 2014 12:26:50 -0600 (CST) Date: Fri, 17 Jan 2014 12:26:50 -0600 From: Josh Cartwright To: Felipe Balbi Subject: Re: [PATCH v2] usb: phy: msm: fix compilation errors when !CONFIG_PM_SLEEP Message-ID: <20140117182650.GZ8153@joshc.qualcomm.com> References: <87lhyemr3y.fsf@linaro.org> <1389981531-15539-1-git-send-email-joshc@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1389981531-15539-1-git-send-email-joshc@codeaurora.org> User-Agent: Mutt/1.5.21 (2012-12-30) X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140117_133004_437353_CCBB6F23 X-CRM114-Status: GOOD ( 27.89 ) X-Spam-Score: -2.2 (--) Cc: Kevin Hilman , Russell King - ARM Linux , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Christopher Covington , "Ivan T. Ivanov" , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jan 17, 2014 at 11:58:51AM -0600, Josh Cartwright wrote: > Both the PM_RUNTIME and PM_SLEEP callbacks call into the common > msm_otg_{suspend,resume} routines, however these routines are only being > built when CONFIG_PM_SLEEP. In addition, msm_otg_{suspend,resume} also > depends on msm_hsusb_config_vddcx(), which is only built when > CONFIG_PM_SLEEP. > > Fix the CONFIG_PM_RUNTIME, !CONFIG_PM_SLEEP case by changing the > preprocessor conditional, and moving msm_hsusb_config_vddcx(). > > While we're here, eliminate the CONFIG_PM conditional for setting > up the dev_pm_ops. > > This address the following errors Russell King has hit doing randconfig > builds: > > drivers/usb/phy/phy-msm-usb.c: In function 'msm_otg_runtime_suspend': > drivers/usb/phy/phy-msm-usb.c:1691:2: error: implicit declaration of function 'msm_otg_suspend' > drivers/usb/phy/phy-msm-usb.c: In function 'msm_otg_runtime_resume': > drivers/usb/phy/phy-msm-usb.c:1699:2: error: implicit declaration of function 'msm_otg_resume' > > Cc: Ivan T. Ivanov > Reported-by: Russell King > Signed-off-by: Josh Cartwright > --- > v1->v2: Change conditional to simply CONFIG_PM (thanks ccov and khilman!) > > drivers/usb/phy/phy-msm-usb.c | 57 ++++++++++++++++++++----------------------- > 1 file changed, 26 insertions(+), 31 deletions(-) > > diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c > index 8546c8d..5b169a7 100644 > --- a/drivers/usb/phy/phy-msm-usb.c > +++ b/drivers/usb/phy/phy-msm-usb.c [..] > @@ -440,7 +414,32 @@ static int msm_otg_reset(struct usb_phy *phy) > #define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000) > #define PHY_RESUME_TIMEOUT_USEC (100 * 1000) > > -#ifdef CONFIG_PM_SLEEP > +#if CONFIG_PM *sigh*. This, of course, should have been #ifdef CONFIG_PM. Fixed v3 below. Thanks, Josh -- 8< -- Subject: [PATCH v3] usb: phy: msm: fix compilation errors when !CONFIG_PM_SLEEP Both the PM_RUNTIME and PM_SLEEP callbacks call into the common msm_otg_{suspend,resume} routines, however these routines are only being built when CONFIG_PM_SLEEP. In addition, msm_otg_{suspend,resume} also depends on msm_hsusb_config_vddcx(), which is only built when CONFIG_PM_SLEEP. Fix the CONFIG_PM_RUNTIME, !CONFIG_PM_SLEEP case by changing the preprocessor conditional, and moving msm_hsusb_config_vddcx(). While we're here, eliminate the CONFIG_PM conditional for setting up the dev_pm_ops. This address the following errors Russell King has hit doing randconfig builds: drivers/usb/phy/phy-msm-usb.c: In function 'msm_otg_runtime_suspend': drivers/usb/phy/phy-msm-usb.c:1691:2: error: implicit declaration of function 'msm_otg_suspend' drivers/usb/phy/phy-msm-usb.c: In function 'msm_otg_runtime_resume': drivers/usb/phy/phy-msm-usb.c:1699:2: error: implicit declaration of function 'msm_otg_resume' Cc: Ivan T. Ivanov Reported-by: Russell King Signed-off-by: Josh Cartwright --- drivers/usb/phy/phy-msm-usb.c | 57 ++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 8546c8d..d204f74 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -159,32 +159,6 @@ put_3p3: return rc; } -#ifdef CONFIG_PM_SLEEP -#define USB_PHY_SUSP_DIG_VOL 500000 -static int msm_hsusb_config_vddcx(int high) -{ - int max_vol = USB_PHY_VDD_DIG_VOL_MAX; - int min_vol; - int ret; - - if (high) - min_vol = USB_PHY_VDD_DIG_VOL_MIN; - else - min_vol = USB_PHY_SUSP_DIG_VOL; - - ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol); - if (ret) { - pr_err("%s: unable to set the voltage for regulator " - "HSUSB_VDDCX\n", __func__); - return ret; - } - - pr_debug("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol); - - return ret; -} -#endif - static int msm_hsusb_ldo_set_mode(int on) { int ret = 0; @@ -440,7 +414,32 @@ static int msm_otg_reset(struct usb_phy *phy) #define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000) #define PHY_RESUME_TIMEOUT_USEC (100 * 1000) -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM + +#define USB_PHY_SUSP_DIG_VOL 500000 +static int msm_hsusb_config_vddcx(int high) +{ + int max_vol = USB_PHY_VDD_DIG_VOL_MAX; + int min_vol; + int ret; + + if (high) + min_vol = USB_PHY_VDD_DIG_VOL_MIN; + else + min_vol = USB_PHY_SUSP_DIG_VOL; + + ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol); + if (ret) { + pr_err("%s: unable to set the voltage for regulator " + "HSUSB_VDDCX\n", __func__); + return ret; + } + + pr_debug("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol); + + return ret; +} + static int msm_otg_suspend(struct msm_otg *motg) { struct usb_phy *phy = &motg->phy; @@ -1733,22 +1732,18 @@ static int msm_otg_pm_resume(struct device *dev) } #endif -#ifdef CONFIG_PM static const struct dev_pm_ops msm_otg_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume) SET_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume, msm_otg_runtime_idle) }; -#endif static struct platform_driver msm_otg_driver = { .remove = msm_otg_remove, .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, -#ifdef CONFIG_PM .pm = &msm_otg_dev_pm_ops, -#endif }, };