From: Jonathan Cameron Date: Mon, 2 Jan 2023 18:17:56 +0000 (+0000) Subject: Input: stpmic1_onekey - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5057e0aa48d8711dcdd9cf47b02cc253adce5a80;p=linux.git Input: stpmic1_onekey - 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 Cc: Pascal Paillet Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20230102181842.718010-24-jic23@kernel.org Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/misc/stpmic1_onkey.c b/drivers/input/misc/stpmic1_onkey.c index d8dc2f2f80000..d5ebca7b90a59 100644 --- a/drivers/input/misc/stpmic1_onkey.c +++ b/drivers/input/misc/stpmic1_onkey.c @@ -142,7 +142,7 @@ static int stpmic1_onkey_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused stpmic1_onkey_suspend(struct device *dev) +static int stpmic1_onkey_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct stpmic1_onkey *onkey = platform_get_drvdata(pdev); @@ -154,7 +154,7 @@ static int __maybe_unused stpmic1_onkey_suspend(struct device *dev) return 0; } -static int __maybe_unused stpmic1_onkey_resume(struct device *dev) +static int stpmic1_onkey_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct stpmic1_onkey *onkey = platform_get_drvdata(pdev); @@ -166,9 +166,9 @@ static int __maybe_unused stpmic1_onkey_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm, - stpmic1_onkey_suspend, - stpmic1_onkey_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm, + stpmic1_onkey_suspend, + stpmic1_onkey_resume); static const struct of_device_id of_stpmic1_onkey_match[] = { { .compatible = "st,stpmic1-onkey" }, @@ -182,7 +182,7 @@ static struct platform_driver stpmic1_onkey_driver = { .driver = { .name = "stpmic1_onkey", .of_match_table = of_match_ptr(of_stpmic1_onkey_match), - .pm = &stpmic1_onkey_pm, + .pm = pm_sleep_ptr(&stpmic1_onkey_pm), }, }; module_platform_driver(stpmic1_onkey_driver);