diff mbox series

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

Message ID 20211228001330.816929-1-mezin.alexander@gmail.com (mailing list archive)
State Superseded
Headers show
Series hwmon: (nzxt-smart2) Fix "unused function" warning | expand

Commit Message

Aleksandr Mezin Dec. 28, 2021, 12:13 a.m. UTC
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)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
---
 drivers/hwmon/nzxt-smart2.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Guenter Roeck Dec. 28, 2021, 12:28 a.m. UTC | #1
On 12/27/21 4:13 PM, Aleksandr Mezin wrote:
> 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)
>        |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com>
> ---
>   drivers/hwmon/nzxt-smart2.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/hwmon/nzxt-smart2.c b/drivers/hwmon/nzxt-smart2.c
> index 534d39b8908e..6033249bf06d 100644
> --- a/drivers/hwmon/nzxt-smart2.c
> +++ b/drivers/hwmon/nzxt-smart2.c
> @@ -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

>   {
>   	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)
>   {
>
diff mbox series

Patch

diff --git a/drivers/hwmon/nzxt-smart2.c b/drivers/hwmon/nzxt-smart2.c
index 534d39b8908e..6033249bf06d 100644
--- a/drivers/hwmon/nzxt-smart2.c
+++ b/drivers/hwmon/nzxt-smart2.c
@@ -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)
 {