linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: qcom: tsens-8916: mark PM functions __maybe_unused
@ 2016-07-04 13:12 Arnd Bergmann
  2016-07-05  2:37 ` Rajendra Nayak
  2016-08-19 12:44 ` Zhang Rui
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-07-04 13:12 UTC (permalink / raw)
  To: Eduardo Valentin
  Cc: Arnd Bergmann, Zhang Rui, Rajendra Nayak, Lina Iyer, linux-pm,
	linux-kernel

The newly added tsens-8916 driver produces warnings when CONFIG_PM
is disabled:

drivers/thermal/qcom/tsens.c:53:12: error: 'tsens_resume' defined but not used [-Werror=unused-function]
 static int tsens_resume(struct device *dev)
            ^~~~~~~~~~~~
drivers/thermal/qcom/tsens.c:43:12: error: 'tsens_suspend' defined but not used [-Werror=unused-function]
 static int tsens_suspend(struct device *dev)
            ^~~~~~~~~~~~~

This marks both functions __maybe_unused to let the compiler
know that they might be used in other configurations, without
adding ugly #ifdef logic.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/thermal/qcom/tsens.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 446f70b5dbb2..e4fca3350d26 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -40,7 +40,7 @@ static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend)
 	return -ENOTSUPP;
 }
 
-static int tsens_suspend(struct device *dev)
+static int  __maybe_unused tsens_suspend(struct device *dev)
 {
 	struct tsens_device *tmdev = dev_get_drvdata(dev);
 
@@ -50,7 +50,7 @@ static int tsens_suspend(struct device *dev)
 	return 0;
 }
 
-static int tsens_resume(struct device *dev)
+static int __maybe_unused  tsens_resume(struct device *dev)
 {
 	struct tsens_device *tmdev = dev_get_drvdata(dev);
 
-- 
2.9.0

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

* Re: [PATCH] thermal: qcom: tsens-8916: mark PM functions __maybe_unused
  2016-07-04 13:12 [PATCH] thermal: qcom: tsens-8916: mark PM functions __maybe_unused Arnd Bergmann
@ 2016-07-05  2:37 ` Rajendra Nayak
  2016-08-19 12:44 ` Zhang Rui
  1 sibling, 0 replies; 3+ messages in thread
From: Rajendra Nayak @ 2016-07-05  2:37 UTC (permalink / raw)
  To: Arnd Bergmann, Eduardo Valentin
  Cc: Zhang Rui, Lina Iyer, linux-pm, linux-kernel


On 07/04/2016 06:42 PM, Arnd Bergmann wrote:
> The newly added tsens-8916 driver produces warnings when CONFIG_PM
> is disabled:
> 
> drivers/thermal/qcom/tsens.c:53:12: error: 'tsens_resume' defined but not used [-Werror=unused-function]
>  static int tsens_resume(struct device *dev)
>             ^~~~~~~~~~~~
> drivers/thermal/qcom/tsens.c:43:12: error: 'tsens_suspend' defined but not used [-Werror=unused-function]
>  static int tsens_suspend(struct device *dev)
>             ^~~~~~~~~~~~~
> 
> This marks both functions __maybe_unused to let the compiler
> know that they might be used in other configurations, without
> adding ugly #ifdef logic.

Thanks Arnd,
Reviewed-by: Rajendra Nayak <rnayak@codeaurora.org>

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/thermal/qcom/tsens.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index 446f70b5dbb2..e4fca3350d26 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -40,7 +40,7 @@ static int tsens_get_trend(void *p, int trip, enum thermal_trend *trend)
>  	return -ENOTSUPP;
>  }
>  
> -static int tsens_suspend(struct device *dev)
> +static int  __maybe_unused tsens_suspend(struct device *dev)
>  {
>  	struct tsens_device *tmdev = dev_get_drvdata(dev);
>  
> @@ -50,7 +50,7 @@ static int tsens_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int tsens_resume(struct device *dev)
> +static int __maybe_unused  tsens_resume(struct device *dev)
>  {
>  	struct tsens_device *tmdev = dev_get_drvdata(dev);
>  
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* Re: [PATCH] thermal: qcom: tsens-8916: mark PM functions __maybe_unused
  2016-07-04 13:12 [PATCH] thermal: qcom: tsens-8916: mark PM functions __maybe_unused Arnd Bergmann
  2016-07-05  2:37 ` Rajendra Nayak
@ 2016-08-19 12:44 ` Zhang Rui
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2016-08-19 12:44 UTC (permalink / raw)
  To: Arnd Bergmann, Eduardo Valentin
  Cc: Rajendra Nayak, Lina Iyer, linux-pm, linux-kernel

On 一, 2016-07-04 at 15:12 +0200, Arnd Bergmann wrote:
> The newly added tsens-8916 driver produces warnings when CONFIG_PM
> is disabled:
> 
> drivers/thermal/qcom/tsens.c:53:12: error: 'tsens_resume' defined but
> not used [-Werror=unused-function]
>  static int tsens_resume(struct device *dev)
>             ^~~~~~~~~~~~
> drivers/thermal/qcom/tsens.c:43:12: error: 'tsens_suspend' defined
> but not used [-Werror=unused-function]
>  static int tsens_suspend(struct device *dev)
>             ^~~~~~~~~~~~~
> 
> This marks both functions __maybe_unused to let the compiler
> know that they might be used in other configurations, without
> adding ugly #ifdef logic.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Patch queued for 4.9, with a minor fix for the following checkpatch
error,

ERROR: "foo __maybe_unused  bar" should be "foo __maybe_unused bar"
#54: FILE: drivers/thermal/qcom/tsens.c:53:
+static int __maybe_unused  tsens_resume(struct device *dev)

total: 1 errors, 0 warnings, 16 lines checked

thanks,
rui

> ---
>  drivers/thermal/qcom/tsens.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/qcom/tsens.c
> b/drivers/thermal/qcom/tsens.c
> index 446f70b5dbb2..e4fca3350d26 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -40,7 +40,7 @@ static int tsens_get_trend(void *p, int trip, enum
> thermal_trend *trend)
>  	return -ENOTSUPP;
>  }
>  
> -static int tsens_suspend(struct device *dev)
> +static int  __maybe_unused tsens_suspend(struct device *dev)
>  {
>  	struct tsens_device *tmdev = dev_get_drvdata(dev);
>  
> @@ -50,7 +50,7 @@ static int tsens_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int tsens_resume(struct device *dev)
> +static int __maybe_unused  tsens_resume(struct device *dev)
>  {
>  	struct tsens_device *tmdev = dev_get_drvdata(dev);
>  

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

end of thread, other threads:[~2016-08-19 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-04 13:12 [PATCH] thermal: qcom: tsens-8916: mark PM functions __maybe_unused Arnd Bergmann
2016-07-05  2:37 ` Rajendra Nayak
2016-08-19 12:44 ` Zhang Rui

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