All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: thermal: processor_thermal: mark pm function __maybe_unused
@ 2019-07-08 12:47 Arnd Bergmann
  2019-07-10 13:34 ` Zhang Rui
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2019-07-08 12:47 UTC (permalink / raw)
  To: Zhang Rui, Eduardo Valentin
  Cc: Arnd Bergmann, Srinivas Pandruvada, Daniel Lezcano, linux-pm,
	linux-kernel

Without CONFIG_PM, we get a harmless warning:

drivers/thermal/intel/int340x_thermal/processor_thermal_device.c:446:12: error: 'proc_thermal_resume' defined but not used [-Werror=unused-function]
 static int proc_thermal_resume(struct device *dev)

Mark it __maybe_unused to shut up the warning.

Fixes: aaba9791fbb4 ("drivers: thermal: processor_thermal: Read PPCC on resume")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../thermal/intel/int340x_thermal/processor_thermal_device.c    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
index a3210f09f366..5ce639a99330 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
@@ -443,7 +443,7 @@ static void  proc_thermal_pci_remove(struct pci_dev *pdev)
 	pci_disable_device(pdev);
 }
 
-static int proc_thermal_resume(struct device *dev)
+static int __maybe_unused proc_thermal_resume(struct device *dev)
 {
 	struct proc_thermal_device *proc_dev;
 
-- 
2.20.0


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

* Re: [PATCH] drivers: thermal: processor_thermal: mark pm function __maybe_unused
  2019-07-08 12:47 [PATCH] drivers: thermal: processor_thermal: mark pm function __maybe_unused Arnd Bergmann
@ 2019-07-10 13:34 ` Zhang Rui
  2019-07-10 14:19   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Rui @ 2019-07-10 13:34 UTC (permalink / raw)
  To: Arnd Bergmann, Eduardo Valentin
  Cc: Srinivas Pandruvada, Daniel Lezcano, linux-pm, linux-kernel

Hi, Arnd,

thanks for the report.

On 一, 2019-07-08 at 14:47 +0200, Arnd Bergmann wrote:
> Without CONFIG_PM, we get a harmless warning:
> 
> drivers/thermal/intel/int340x_thermal/processor_thermal_device.c:446:
> 12: error: 'proc_thermal_resume' defined but not used [-
> Werror=unused-function]
>  static int proc_thermal_resume(struct device *dev)
> 
> Mark it __maybe_unused to shut up the warning.
> 
> Fixes: aaba9791fbb4 ("drivers: thermal: processor_thermal: Read PPCC
> on resume")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  .../thermal/intel/int340x_thermal/processor_thermal_device.c    | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> index a3210f09f366..5ce639a99330 100644
> ---
> a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> +++
> b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> @@ -443,7 +443,7 @@ static void  proc_thermal_pci_remove(struct
> pci_dev *pdev)
>  	pci_disable_device(pdev);
>  }
>  
> -static int proc_thermal_resume(struct device *dev)
> +static int __maybe_unused proc_thermal_resume(struct device *dev)
>  {
>  	struct proc_thermal_device *proc_dev;
>  
I'd rather prefer to add #ifdef CONFIG_PM_SLEEP for
proc_thermal_resume().
Just like the patch below, what do you think?

thanks,
rui

From 6c395f66e98c895cf3ebf87c0b2fc63b6a57a196 Mon Sep 17 00:00:00 2001
From: Zhang Rui <rui.zhang@intel.com>
Date: Tue, 9 Jul 2019 21:19:12 +0800
Subject: [PATCH] drivers: thermal: processor_thermal_device: Fix build warning

As a system sleep callback, proc_thermal_resume() should be defined only
if CONFIG_PM_SLEEP is set.

This fixes a build warning when CONFIG_PM_SLEEP is not set,
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c:446:12: error: 'proc_thermal_resume' defined but not used [-Werror=unused-function]
 static int proc_thermal_resume(struct device *dev)

Fixes: aaba9791fbb4 ("drivers: thermal: processor_thermal: Read PPCC on resume")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/intel/int340x_thermal/processor_thermal_device.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
index a3210f0..77dae1e 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
@@ -443,6 +443,7 @@ static void  proc_thermal_pci_remove(struct pci_dev *pdev)
 	pci_disable_device(pdev);
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int proc_thermal_resume(struct device *dev)
 {
 	struct proc_thermal_device *proc_dev;
@@ -452,6 +453,9 @@ static int proc_thermal_resume(struct device *dev)
 
 	return 0;
 }
+#else
+#define proc_thermal_resume NULL
+#endif
 
 static SIMPLE_DEV_PM_OPS(proc_thermal_pm, NULL, proc_thermal_resume);
 
-- 
2.7.4


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

* Re: [PATCH] drivers: thermal: processor_thermal: mark pm function __maybe_unused
  2019-07-10 13:34 ` Zhang Rui
@ 2019-07-10 14:19   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-07-10 14:19 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Eduardo Valentin, Srinivas Pandruvada, Daniel Lezcano,
	Linux PM list, Linux Kernel Mailing List

On Wed, Jul 10, 2019 at 3:34 PM Zhang Rui <rui.zhang@intel.com> wrote:

>
> From 6c395f66e98c895cf3ebf87c0b2fc63b6a57a196 Mon Sep 17 00:00:00 2001
> From: Zhang Rui <rui.zhang@intel.com>
> Date: Tue, 9 Jul 2019 21:19:12 +0800
> Subject: [PATCH] drivers: thermal: processor_thermal_device: Fix build warning
>
> As a system sleep callback, proc_thermal_resume() should be defined only
> if CONFIG_PM_SLEEP is set.
>
> This fixes a build warning when CONFIG_PM_SLEEP is not set,
> drivers/thermal/intel/int340x_thermal/processor_thermal_device.c:446:12: error: 'proc_thermal_resume' defined but not used [-Werror=unused-function]
>  static int proc_thermal_resume(struct device *dev)
>
> Fixes: aaba9791fbb4 ("drivers: thermal: processor_thermal: Read PPCC on resume")
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>

This looks correct to me as well.

> ---
>  drivers/thermal/intel/int340x_thermal/processor_thermal_device.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> index a3210f0..77dae1e 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> @@ -443,6 +443,7 @@ static void  proc_thermal_pci_remove(struct pci_dev *pdev)
>         pci_disable_device(pdev);
>  }
>
> +#ifdef CONFIG_PM_SLEEP
>  static int proc_thermal_resume(struct device *dev)
>  {
>         struct proc_thermal_device *proc_dev;
> @@ -452,6 +453,9 @@ static int proc_thermal_resume(struct device *dev)
>
>         return 0;
>  }
> +#else
> +#define proc_thermal_resume NULL
> +#endif

I would suggest you drop the #else part though, as it is not needed here.

Please apply whichever version you find most readable otherwise.

Thanks,

       Arnd

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

end of thread, other threads:[~2019-07-10 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 12:47 [PATCH] drivers: thermal: processor_thermal: mark pm function __maybe_unused Arnd Bergmann
2019-07-10 13:34 ` Zhang Rui
2019-07-10 14:19   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.