Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (ina3221) mark PM functions as __maybe_unused

When CONFIG_PM_SLEEP is disabled, we get a warning about unused
suspend/resume functions:

drivers/hwmon/ina3221.c:451:12: error: 'ina3221_resume' defined but not used [-Werror=unused-function]
static int ina3221_resume(struct device *dev)
drivers/hwmon/ina3221.c:428:12: error: 'ina3221_suspend' defined but not used [-Werror=unused-function]
static int ina3221_suspend(struct device *dev)

Picking the correct #ifdef check is hard, so let's remove
that check and instead mark the functions as __maybe_unused
to let the compiler silently drop them instead.

Fixes: 7de1ab9dac8e ("hwmon: (ina3221) Add suspend and resume functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Arnd Bergmann and committed by
Guenter Roeck
ead21c77 a9e9dd9c

+2 -4
+2 -4
drivers/hwmon/ina3221.c
··· 631 631 return 0; 632 632 } 633 633 634 - #ifdef CONFIG_PM 635 - static int ina3221_suspend(struct device *dev) 634 + static int __maybe_unused ina3221_suspend(struct device *dev) 636 635 { 637 636 struct ina3221_data *ina = dev_get_drvdata(dev); 638 637 int ret; ··· 654 655 return 0; 655 656 } 656 657 657 - static int ina3221_resume(struct device *dev) 658 + static int __maybe_unused ina3221_resume(struct device *dev) 658 659 { 659 660 struct ina3221_data *ina = dev_get_drvdata(dev); 660 661 int ret; ··· 680 681 681 682 return 0; 682 683 } 683 - #endif 684 684 685 685 static const struct dev_pm_ops ina3221_pm = { 686 686 SET_SYSTEM_SLEEP_PM_OPS(ina3221_suspend, ina3221_resume)