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

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

authored by

Jonathan Cameron and committed by
Dmitry Torokhov
4268a06b 1a3e6c1e

+5 -5
+5 -5
drivers/input/misc/rotary_encoder.c
··· 317 317 return 0; 318 318 } 319 319 320 - static int __maybe_unused rotary_encoder_suspend(struct device *dev) 320 + static int rotary_encoder_suspend(struct device *dev) 321 321 { 322 322 struct rotary_encoder *encoder = dev_get_drvdata(dev); 323 323 unsigned int i; ··· 330 330 return 0; 331 331 } 332 332 333 - static int __maybe_unused rotary_encoder_resume(struct device *dev) 333 + static int rotary_encoder_resume(struct device *dev) 334 334 { 335 335 struct rotary_encoder *encoder = dev_get_drvdata(dev); 336 336 unsigned int i; ··· 343 343 return 0; 344 344 } 345 345 346 - static SIMPLE_DEV_PM_OPS(rotary_encoder_pm_ops, 347 - rotary_encoder_suspend, rotary_encoder_resume); 346 + static DEFINE_SIMPLE_DEV_PM_OPS(rotary_encoder_pm_ops, 347 + rotary_encoder_suspend, rotary_encoder_resume); 348 348 349 349 #ifdef CONFIG_OF 350 350 static const struct of_device_id rotary_encoder_of_match[] = { ··· 358 358 .probe = rotary_encoder_probe, 359 359 .driver = { 360 360 .name = DRV_NAME, 361 - .pm = &rotary_encoder_pm_ops, 361 + .pm = pm_sleep_ptr(&rotary_encoder_pm_ops), 362 362 .of_match_table = of_match_ptr(rotary_encoder_of_match), 363 363 } 364 364 };