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

thermal: spear: use __maybe_unused for PM functions

The spear thermal driver hides its suspend/resume function conditionally
based on CONFIG_PM, but references them based on CONFIG_PM_SLEEP, so
we get a warning if the former is set but the latter is not:

thermal/spear_thermal.c:58:12: warning: 'spear_thermal_suspend' defined but not used [-Wunused-function]
thermal/spear_thermal.c:75:12: warning: 'spear_thermal_resume' defined but not used [-Wunused-function]

This removes the #ifdef and instead uses a __maybe_uninitialized
annotation to avoid the warning and improve compile-time coverage.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>

authored by

Arnd Bergmann and committed by
Eduardo Valentin
d612c64d 8b477ea5

+2 -4
+2 -4
drivers/thermal/spear_thermal.c
··· 54 54 .get_temp = thermal_get_temp, 55 55 }; 56 56 57 - #ifdef CONFIG_PM 58 - static int spear_thermal_suspend(struct device *dev) 57 + static int __maybe_unused spear_thermal_suspend(struct device *dev) 59 58 { 60 59 struct platform_device *pdev = to_platform_device(dev); 61 60 struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); ··· 71 72 return 0; 72 73 } 73 74 74 - static int spear_thermal_resume(struct device *dev) 75 + static int __maybe_unused spear_thermal_resume(struct device *dev) 75 76 { 76 77 struct platform_device *pdev = to_platform_device(dev); 77 78 struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); ··· 93 94 94 95 return 0; 95 96 } 96 - #endif 97 97 98 98 static SIMPLE_DEV_PM_OPS(spear_thermal_pm_ops, spear_thermal_suspend, 99 99 spear_thermal_resume);