Skip to contentSkip to conversation

hwmon: (nzxt-smart2) Fix "unused function" warning

PATCH Superseded Aleksandr Mezin 2 participants 2 messages Dec 28, 2021 Hardware monitoring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (nzxt-smart2) Fix "unused function" warning

Fix warning when building with CONFIG_PM=n (and CONFIG_WERROR=y):

drivers/hwmon/nzxt-smart2.c:707:12: error: ‘nzxt_smart2_hid_reset_resume’ defined but not used [-Werror=unused-function]
707 | static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev)

      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 drivers/hwmon/nzxt-smart2.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/hwmon/nzxt-smart2.c +4 -0
index 534d39b8908e..6033249bf06d 100644
@@ -704,6 +704,8 @@ static int nzxt_smart2_hid_raw_event(struct hid_device *hdev,
 	return 0;
 }
 
+#ifdef CONFIG_PM
+
 static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev)
 {
 	struct drvdata *drvdata = hid_get_drvdata(hdev);
@@ -721,6 +723,8 @@ static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev)
 	return init_device(drvdata, drvdata->update_interval);
 }
 
+#endif
+
 static int nzxt_smart2_hid_probe(struct hid_device *hdev,
 				 const struct hid_device_id *id)
 {
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 17 lines · Aleksandr Mezin

Fix warning when building with CONFIG_PM=n (and CONFIG_WERROR=y):

drivers/hwmon/nzxt-smart2.c:707:12: error: ‘nzxt_smart2_hid_reset_resume’ defined but not used [-Werror=unused-function]
707 | static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev)

       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
  drivers/hwmon/nzxt-smart2.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/hwmon/nzxt-smart2.c +0 -0
index 534d39b8908e..6033249bf06d 100644

drivers/hwmon/nzxt-smart2.c static int nzxt_smart2_hid_raw_event(struct hid_device *hdev, · line 709

Quoted 6 lines
drivers/hwmon/nzxt-smart2.c +2 -0
@@ -704,6 +704,8 @@ static int nzxt_smart2_hid_raw_event(struct hid_device *hdev,
  	return 0;
  }
 
+#ifdef CONFIG_PM
+
  static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev)

Please use __maybe_unused instead.

Guenter

Quoted 12 lines
drivers/hwmon/nzxt-smart2.c +2 -0
  {
  	struct drvdata *drvdata = hid_get_drvdata(hdev);
@@ -721,6 +723,8 @@ static int nzxt_smart2_hid_reset_resume(struct hid_device *hdev)
  	return init_device(drvdata, drvdata->update_interval);
  }
 
+#endif
+
  static int nzxt_smart2_hid_probe(struct hid_device *hdev,
  				 const struct hid_device_id *id)
  {