linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] usb: dwc2: Fix build warning when CONFIG_PM_SLEEP=n
       [not found] ` <20141119150148.GA5202@saruman>
@ 2014-11-22  1:18   ` Rafael J. Wysocki
  0 siblings, 0 replies; only message in thread
From: Rafael J. Wysocki @ 2014-11-22  1:18 UTC (permalink / raw)
  To: balbi, Fabio Estevam
  Cc: paulz, gregkh, linux-usb, Linux PM, Rafael J. Wysocki

On 11/19/2014 4:01 PM, Felipe Balbi wrote:
> 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@lixom.net>
>> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>> ---
>>   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:

I might, but ->

> 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

-> that is not true.  The "tiny kernel" people what to be able to unset 
CONFIG_PM in particular.

> or any of its friends anyway and all that ifdeferry or __maybe_unused just to silence
> compilers warnings are very annoying.
>

We are modifying the power Kconfig in 3.19-rc1 so that PM_SLEEP will 
always select PM_RUNTIME, so some of the #ifdefs can safely go away.

Rafael


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-22  1:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1416407873-18166-1-git-send-email-fabio.estevam@freescale.com>
     [not found] ` <20141119150148.GA5202@saruman>
2014-11-22  1:18   ` [PATCH] usb: dwc2: Fix build warning when CONFIG_PM_SLEEP=n Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).