linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com>,
	Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org, greybus-dev@lists.linaro.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [greybus-dev] [PATCH] staging: greybus: mark PM functions as __maybe_unused
Date: Thu, 18 May 2017 16:51:05 +0200	[thread overview]
Message-ID: <CAK8P3a2c_Q9gzmFqJmPkiz780M5s6+yN+q+3-PaOrYVz=Utc-Q@mail.gmail.com> (raw)
In-Reply-To: <20170518141800.GI17481@vireshk-i7>

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

  reply	other threads:[~2017-05-18 14:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 13:28 [PATCH] staging: greybus: mark PM functions as __maybe_unused Arnd Bergmann
2017-05-18 13:33 ` Johan Hovold
2017-05-18 14:18 ` [greybus-dev] " Viresh Kumar
2017-05-18 14:51   ` Arnd Bergmann [this message]
2017-05-19  3:40     ` Viresh Kumar
2017-05-19  6:57       ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK8P3a2c_Q9gzmFqJmPkiz780M5s6+yN+q+3-PaOrYVz=Utc-Q@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=hvaibhav.linux@gmail.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).