Skip to contentSkip to conversation

thermal: qcom: tsens-8916: mark PM functions __maybe_unused

PATCH In review Arnd Bergmann 3 participants 3 messages Jul 4, 2016 – Aug 19, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: qcom: tsens-8916: mark PM functions __maybe_unused

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.

---
 drivers/thermal/qcom/tsens.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens.c +2 -2
index 446f70b5dbb2..e4fca3350d26 100644
@@ -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);
 
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

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)

Quoted 8 lines
            ^~~~~~~~~~~~
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,

Quoted 29 lines
---
 drivers/thermal/qcom/tsens.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens.c +2 -2
index 446f70b5dbb2..e4fca3350d26 100644
@@ -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);
 
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
reviewer
#2 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

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) ^~~~~~~~~~~~~

Quoted 5 lines

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

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

Quoted 28 lines

---
 drivers/thermal/qcom/tsens.c | 4 ++--

 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/qcom/tsens.c +0 -0
index 446f70b5dbb2..e4fca3350d26 100644
@@ -40,7 +40,7 @@ static int tsens_get_trend(void *p, int trip, enum
 thermal_trend *trend)
  	return -ENOTSUPP;
  }

drivers/thermal/qcom/tsens.c +1 -1
-static int tsens_suspend(struct device *dev)
+static int  __maybe_unused tsens_suspend(struct device *dev)

 {
  struct tsens_device *tmdev = dev_get_drvdata(dev);

drivers/thermal/qcom/tsens.c +0 -0
@@ -50,7 +50,7 @@ static int tsens_suspend(struct device *dev)
  	return 0;
  }

drivers/thermal/qcom/tsens.c +1 -1
-static int tsens_resume(struct device *dev)
+static int __maybe_unused  tsens_resume(struct device *dev)

 {
  struct tsens_device *tmdev = dev_get_drvdata(dev);