Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1644650

Re: [greybus-dev] [PATCH] staging: greybus: mark PM functions as __maybe_unused

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [greybus-dev] [PATCH] staging: greybus: mark PM functions as __maybe_unused
Date 2017-05-18 17:00 +0200
Message-ID <tIv4e-47X-33@gated-at.bofh.it> (permalink)
References <tItF7-37o-19@gated-at.bofh.it> <tIurv-3RH-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 18, 2017 at 4:18 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 18-05-17, 15:28, Arnd Bergmann wrote:
>> Enabling the arche platform for compile testing showed a harmless
>> warning with CONFIG_PM=n:
>>
>> drivers/staging/greybus/arche-platform.c:632:12: error: 'arche_platform_resume' defined but not used [-Werror=unused-function]
>> drivers/staging/greybus/arche-platform.c:618:12: error: 'arche_platform_suspend' defined but not used [-Werror=unused-function]
>>
>> This marks the functions as __maybe_unused to shut up the warnings.
>>
>> Fixes: 2eccd4aa19fc ("staging: greybus: enable compile testing of arche driver")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/staging/greybus/arche-platform.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
>> index 5bce5e039596..eced2d26467b 100644
>> --- a/drivers/staging/greybus/arche-platform.c
>> +++ b/drivers/staging/greybus/arche-platform.c
>> @@ -615,7 +615,7 @@ static int arche_platform_remove(struct platform_device *pdev)
>>       return 0;
>>  }
>>
>> -static int arche_platform_suspend(struct device *dev)
>> +static __maybe_unused int arche_platform_suspend(struct device *dev)
>>  {
>>       /*
>>        * If timing profile premits, we may shutdown bridge
>> @@ -629,7 +629,7 @@ static int arche_platform_suspend(struct device *dev)
>>       return 0;
>>  }
>>
>> -static int arche_platform_resume(struct device *dev)
>> +static __maybe_unused int arche_platform_resume(struct device *dev)
>>  {
>>       /*
>>        * Atleast for ES2 we have to meet the delay requirement between
>
> Is __maybe_unused the more preferred way than putting these routines
> under CONFIG_PM_SLEEP ifdef ?

I find that a lot of users get the #ifdef wrong, either using the wrong
macro (CONFIG_PM vs CONFIG_PM_SLEEP) or not using the right
set of functions (e.g. calling a function only from the suspend handler).

The __maybe_unused annotation avoids both problems and also gives
better build time coverage, so that's what I tend to use.

     Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] staging: greybus: mark PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-05-18 15:30 +0200
  Re: [PATCH] staging: greybus: mark PM functions as __maybe_unused Johan Hovold <johan@kernel.org> - 2017-05-18 15:40 +0200
  Re: [greybus-dev] [PATCH] staging: greybus: mark PM functions as  __maybe_unused Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-18 16:20 +0200
    Re: [greybus-dev] [PATCH] staging: greybus: mark PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-05-18 17:00 +0200
      Re: [greybus-dev] [PATCH] staging: greybus: mark PM functions as  __maybe_unused Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-19 05:50 +0200
        Re: [greybus-dev] [PATCH] staging: greybus: mark PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-05-19 09:00 +0200

csiph-web