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

Input: pwm-vibra - 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-21-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jonathan Cameron and committed by
Dmitry Torokhov
e4b4592f 349fe1e4

+5 -5
+5 -5
drivers/input/misc/pwm-vibra.c
··· 222 222 return 0; 223 223 } 224 224 225 - static int __maybe_unused pwm_vibrator_suspend(struct device *dev) 225 + static int pwm_vibrator_suspend(struct device *dev) 226 226 { 227 227 struct pwm_vibrator *vibrator = dev_get_drvdata(dev); 228 228 ··· 233 233 return 0; 234 234 } 235 235 236 - static int __maybe_unused pwm_vibrator_resume(struct device *dev) 236 + static int pwm_vibrator_resume(struct device *dev) 237 237 { 238 238 struct pwm_vibrator *vibrator = dev_get_drvdata(dev); 239 239 ··· 243 243 return 0; 244 244 } 245 245 246 - static SIMPLE_DEV_PM_OPS(pwm_vibrator_pm_ops, 247 - pwm_vibrator_suspend, pwm_vibrator_resume); 246 + static DEFINE_SIMPLE_DEV_PM_OPS(pwm_vibrator_pm_ops, 247 + pwm_vibrator_suspend, pwm_vibrator_resume); 248 248 249 249 #ifdef CONFIG_OF 250 250 static const struct of_device_id pwm_vibra_dt_match_table[] = { ··· 258 258 .probe = pwm_vibrator_probe, 259 259 .driver = { 260 260 .name = "pwm-vibrator", 261 - .pm = &pwm_vibrator_pm_ops, 261 + .pm = pm_sleep_ptr(&pwm_vibrator_pm_ops), 262 262 .of_match_table = of_match_ptr(pwm_vibra_dt_match_table), 263 263 }, 264 264 };