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

Input: e3x0-button - 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>
Cc: Moritz Fischer <mdf@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230102181842.718010-7-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jonathan Cameron and committed by
Dmitry Torokhov
5ad71cbd 0e076fce

+5 -5
+5 -5
drivers/input/misc/e3x0-button.c
··· 35 35 return IRQ_HANDLED; 36 36 } 37 37 38 - static int __maybe_unused e3x0_button_suspend(struct device *dev) 38 + static int e3x0_button_suspend(struct device *dev) 39 39 { 40 40 struct platform_device *pdev = to_platform_device(dev); 41 41 ··· 45 45 return 0; 46 46 } 47 47 48 - static int __maybe_unused e3x0_button_resume(struct device *dev) 48 + static int e3x0_button_resume(struct device *dev) 49 49 { 50 50 struct platform_device *pdev = to_platform_device(dev); 51 51 ··· 55 55 return 0; 56 56 } 57 57 58 - static SIMPLE_DEV_PM_OPS(e3x0_button_pm_ops, 59 - e3x0_button_suspend, e3x0_button_resume); 58 + static DEFINE_SIMPLE_DEV_PM_OPS(e3x0_button_pm_ops, 59 + e3x0_button_suspend, e3x0_button_resume); 60 60 61 61 static int e3x0_button_probe(struct platform_device *pdev) 62 62 { ··· 122 122 .driver = { 123 123 .name = "e3x0-button", 124 124 .of_match_table = of_match_ptr(e3x0_button_match), 125 - .pm = &e3x0_button_pm_ops, 125 + .pm = pm_sleep_ptr(&e3x0_button_pm_ops), 126 126 }, 127 127 .probe = e3x0_button_probe, 128 128 };