Re: [PATCH] thermal: qcom: tsens-8916: mark PM functions __maybe_unused

From: Zhang Rui
Date: Fri Aug 19 2016 - 08:44:41 EST


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@xxxxxxxx>

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);
> Â