Re: [PATCH] usb: dwc2: Fix build warning when CONFIG_PM_SLEEP=n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HI,

On Wed, Nov 19, 2014 at 12:37:53PM -0200, Fabio Estevam wrote:
> Building with bcm2835_defconfig, which has CONFIG_PM_SLEEP=n causes the 
> following build warning:
> 
> drivers/usb/dwc2/platform.c:227:12: warning: 'dwc2_suspend' defined but not used [-Wunused-function]
> drivers/usb/dwc2/platform.c:237:12: warning: 'dwc2_resume' defined but not used [-Wunused-function]
> 
> Annotate these functions with '__maybe_unused' to prevent the warnings.
> 
> Reported-by: Olof's autobuilder <build@xxxxxxxxx>
> Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> ---
>  drivers/usb/dwc2/platform.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 57eb8a3..ff0ed0b 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -224,7 +224,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  	return retval;
>  }
>  
> -static int dwc2_suspend(struct device *dev)
> +static int __maybe_unused dwc2_suspend(struct device *dev)

that SET_SYSTEM_SLEEP_PM_OPS again.

Rafael, do you mind taking a patch like below:

diff --git a/include/linux/pm.h b/include/linux/pm.h
index 383fd68..928e295 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -318,7 +318,6 @@ struct dev_pm_ops {
 	int (*runtime_idle)(struct device *dev);
 };
 
-#ifdef CONFIG_PM_SLEEP
 #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
 	.suspend = suspend_fn, \
 	.resume = resume_fn, \
@@ -326,11 +325,7 @@ struct dev_pm_ops {
 	.thaw = resume_fn, \
 	.poweroff = suspend_fn, \
 	.restore = resume_fn,
-#else
-#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
-#endif
 
-#ifdef CONFIG_PM_SLEEP
 #define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
 	.suspend_late = suspend_fn, \
 	.resume_early = resume_fn, \
@@ -338,27 +333,16 @@ struct dev_pm_ops {
 	.thaw_early = resume_fn, \
 	.poweroff_late = suspend_fn, \
 	.restore_early = resume_fn,
-#else
-#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
-#endif
 
-#ifdef CONFIG_PM_RUNTIME
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	.runtime_suspend = suspend_fn, \
 	.runtime_resume = resume_fn, \
 	.runtime_idle = idle_fn,
-#else
-#define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
-#endif
 
-#ifdef CONFIG_PM
 #define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	.runtime_suspend = suspend_fn, \
 	.runtime_resume = resume_fn, \
 	.runtime_idle = idle_fn,
-#else
-#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
-#endif
 
 /*
  * Use this if you want to use the same suspend and resume callbacks for suspend

nobody will ever build a kernel without CONFIG_PM or any of its friends
anyway and all that ifdeferry or __maybe_unused just to silence
compilers warnings are very annoying.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux