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


Groups > linux.kernel > #1471252

Re: [PATCH] ravb: avoid unused function warnings

From Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Newsgroups linux.kernel
Subject Re: [PATCH] ravb: avoid unused function warnings
Date 2016-08-27 23:50 +0200
Message-ID <saTEd-1mj-3@gated-at.bofh.it> (permalink)
References <saroC-ua-29@gated-at.bofh.it> <say6K-4Jv-5@gated-at.bofh.it>
Organization Cogent Embedded

Show all headers | View raw


Hello.

On 08/27/2016 01:48 AM, Sergei Shtylyov wrote:

>> When CONFIG_PM_SLEEP is disabled, we get a couple of harmless warnings:
>>
>> drivers/net/ethernet/renesas/ravb_main.c:2117:12: error: 'ravb_resume'
>> defined but not used [-Werror=unused-function]
>> drivers/net/ethernet/renesas/ravb_main.c:2104:12: error: 'ravb_suspend'
>> defined but not used [-Werror=unused-function]
>>
>> The simplest solution here is to replace the #ifdef with __maybe_unused
>> annotations, which lets the compiler do the right thing by itself.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> Fixes: 0184165b2f42 ("ravb: add sleep PM suspend/resume support")
>
>    That was the patch I didn't review, sorry about that...
>
>> ---
>>  drivers/net/ethernet/renesas/ravb_main.c | 14 ++++----------
>>  1 file changed, 4 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>> b/drivers/net/ethernet/renesas/ravb_main.c
>> index cad23ba06904..630536bc72f9 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> [...]
>> @@ -2166,17 +2165,12 @@ static const struct dev_pm_ops ravb_dev_pm_ops = {
>>      SET_RUNTIME_PM_OPS(ravb_runtime_nop, ravb_runtime_nop, NULL)
>>  };
>>
>> -#define RAVB_PM_OPS (&ravb_dev_pm_ops)
>> -#else
>> -#define RAVB_PM_OPS NULL
>> -#endif
>> -
>>  static struct platform_driver ravb_driver = {
>>      .probe        = ravb_probe,
>>      .remove        = ravb_remove,
>>      .driver = {
>>          .name    = "ravb",
>> -        .pm    = RAVB_PM_OPS,
>> +        .pm    = &ravb_dev_pm_ops,
>
>    I guess it's safe to have this pointing to the 'struct dev_pm_ops' filled
> with NULLs? Looking at the PM code left me somewhat unsure...

    Well, this means CONFIG_PM[_SLEEP] not defined anyway and the PM code 
calling the methods absent, so it should be safe indeed...

Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

MBR, Sergei

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


Thread

[PATCH] ravb: avoid unused function warnings Arnd Bergmann <arnd@arndb.de> - 2016-08-26 17:40 +0200
  Re: [PATCH] ravb: avoid unused function warnings Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-08-27 00:50 +0200
    Re: [PATCH] ravb: avoid unused function warnings Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-08-27 23:50 +0200
  Re: [PATCH] ravb: avoid unused function warnings David Miller <davem@davemloft.net> - 2016-08-31 08:40 +0200

csiph-web