linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ravb: avoid unused function warnings
@ 2016-08-26 15:30 Arnd Bergmann
  2016-08-26 22:48 ` Sergei Shtylyov
  2016-08-31  6:32 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-08-26 15:30 UTC (permalink / raw)
  To: David S. Miller, Sergei Shtylyov
  Cc: Arnd Bergmann, Yoshihiro Kaneko, Kazuya Mizuguchi, Simon Horman,
	Masaru Nagai, Niklas Söderlund, netdev, linux-renesas-soc,
	linux-kernel

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")
---
 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
@@ -2100,8 +2100,7 @@ static int ravb_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int ravb_suspend(struct device *dev)
+static int __maybe_unused ravb_suspend(struct device *dev)
 {
 	struct net_device *ndev = dev_get_drvdata(dev);
 	int ret = 0;
@@ -2114,7 +2113,7 @@ static int ravb_suspend(struct device *dev)
 	return ret;
 }
 
-static int ravb_resume(struct device *dev)
+static int __maybe_unused ravb_resume(struct device *dev)
 {
 	struct net_device *ndev = dev_get_drvdata(dev);
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -2149,7 +2148,7 @@ static int ravb_resume(struct device *dev)
 	return ret;
 }
 
-static int ravb_runtime_nop(struct device *dev)
+static int __maybe_unused ravb_runtime_nop(struct device *dev)
 {
 	/* Runtime PM callback shared between ->runtime_suspend()
 	 * and ->runtime_resume(). Simply returns success.
@@ -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,
 		.of_match_table = ravb_match_table,
 	},
 };
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ravb: avoid unused function warnings
  2016-08-26 15:30 [PATCH] ravb: avoid unused function warnings Arnd Bergmann
@ 2016-08-26 22:48 ` Sergei Shtylyov
  2016-08-27 21:48   ` Sergei Shtylyov
  2016-08-31  6:32 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2016-08-26 22:48 UTC (permalink / raw)
  To: Arnd Bergmann, David S. Miller
  Cc: Yoshihiro Kaneko, Kazuya Mizuguchi, Simon Horman, Masaru Nagai,
	Niklas Söderlund, netdev, linux-renesas-soc, linux-kernel

Hello.

On 08/26/2016 06:30 PM, Arnd Bergmann 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...

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ravb: avoid unused function warnings
  2016-08-26 22:48 ` Sergei Shtylyov
@ 2016-08-27 21:48   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2016-08-27 21:48 UTC (permalink / raw)
  To: Arnd Bergmann, David S. Miller
  Cc: Yoshihiro Kaneko, Kazuya Mizuguchi, Simon Horman, Masaru Nagai,
	Niklas Söderlund, netdev, linux-renesas-soc, linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ravb: avoid unused function warnings
  2016-08-26 15:30 [PATCH] ravb: avoid unused function warnings Arnd Bergmann
  2016-08-26 22:48 ` Sergei Shtylyov
@ 2016-08-31  6:32 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-08-31  6:32 UTC (permalink / raw)
  To: arnd
  Cc: sergei.shtylyov, ykaneko0929, kazuya.mizuguchi.ks, horms+renesas,
	masaru.nagai.vx, niklas.soderlund+renesas, netdev,
	linux-renesas-soc, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 26 Aug 2016 17:30:29 +0200

> 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")

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-31  6:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26 15:30 [PATCH] ravb: avoid unused function warnings Arnd Bergmann
2016-08-26 22:48 ` Sergei Shtylyov
2016-08-27 21:48   ` Sergei Shtylyov
2016-08-31  6:32 ` David Miller

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).