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

Input: regulator-haptic - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

SIMPLE_DEV_PM_OPS() is deprecated as it requires explicit protection
against unused function warnings. The new combination of pm_sleep_ptr()
and DEFINE_SIMPLE_DEV_PM_OPS() allows the compiler to see the functions,
thus suppressing the warning, but still allowing the unused code to be
removed. Thus also drop the __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230102181842.718010-22-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jonathan Cameron and committed by
Dmitry Torokhov
1a3e6c1e e4b4592f

+4 -4
+4 -4
drivers/input/misc/regulator-haptic.c
··· 201 201 return 0; 202 202 } 203 203 204 - static int __maybe_unused regulator_haptic_suspend(struct device *dev) 204 + static int regulator_haptic_suspend(struct device *dev) 205 205 { 206 206 struct platform_device *pdev = to_platform_device(dev); 207 207 struct regulator_haptic *haptic = platform_get_drvdata(pdev); ··· 220 220 return 0; 221 221 } 222 222 223 - static int __maybe_unused regulator_haptic_resume(struct device *dev) 223 + static int regulator_haptic_resume(struct device *dev) 224 224 { 225 225 struct platform_device *pdev = to_platform_device(dev); 226 226 struct regulator_haptic *haptic = platform_get_drvdata(pdev); ··· 239 239 return 0; 240 240 } 241 241 242 - static SIMPLE_DEV_PM_OPS(regulator_haptic_pm_ops, 242 + static DEFINE_SIMPLE_DEV_PM_OPS(regulator_haptic_pm_ops, 243 243 regulator_haptic_suspend, regulator_haptic_resume); 244 244 245 245 static const struct of_device_id regulator_haptic_dt_match[] = { ··· 253 253 .driver = { 254 254 .name = "regulator-haptic", 255 255 .of_match_table = regulator_haptic_dt_match, 256 - .pm = &regulator_haptic_pm_ops, 256 + .pm = pm_sleep_ptr(&regulator_haptic_pm_ops), 257 257 }, 258 258 }; 259 259 module_platform_driver(regulator_haptic_driver);