diff mbox

[v2] usb: phy: msm: fix compilation errors when !CONFIG_PM_SLEEP

Message ID 20140117182650.GZ8153@joshc.qualcomm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Josh Cartwright Jan. 17, 2014, 6:26 p.m. UTC
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 <iivanov@mm-sol.com>
> Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> ---
> 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 <iivanov@mm-sol.com>
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
 drivers/usb/phy/phy-msm-usb.c | 57 ++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 31 deletions(-)

Comments

Felipe Balbi Feb. 18, 2014, 4:24 p.m. UTC | #1
On Fri, Jan 17, 2014 at 12:26:50PM -0600, Josh Cartwright wrote:
> 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 <iivanov@mm-sol.com>
> > Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> > Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> > ---
> > 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.

sorry, please git send-email it properly.
Josh Cartwright Feb. 18, 2014, 4:33 p.m. UTC | #2
On Tue, Feb 18, 2014 at 10:24:16AM -0600, Felipe Balbi wrote:
> On Fri, Jan 17, 2014 at 12:26:50PM -0600, Josh Cartwright wrote:
> > 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 <iivanov@mm-sol.com>
> > > Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> > > Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> > > ---
> > > 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.
> 
> sorry, please git send-email it properly.

No problem, will do.  FWIW, it's applicable with git am --scissors.
Felipe Balbi Feb. 18, 2014, 4:42 p.m. UTC | #3
On Tue, Feb 18, 2014 at 10:33:21AM -0600, Josh Cartwright wrote:
> On Tue, Feb 18, 2014 at 10:24:16AM -0600, Felipe Balbi wrote:
> > On Fri, Jan 17, 2014 at 12:26:50PM -0600, Josh Cartwright wrote:
> > > 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 <iivanov@mm-sol.com>
> > > > Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> > > > Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> > > > ---
> > > > 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.
> > 
> > sorry, please git send-email it properly.
> 
> No problem, will do.  FWIW, it's applicable with git am --scissors.

ahaa, I didn't know about that option. Thanks :-)
diff mbox

Patch

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
 	},
 };