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

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 <Jonathan.Cameron@huawei.com>
Cc: Pascal Paillet <p.paillet@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230102181842.718010-24-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Jonathan Cameron and committed by
Dmitry Torokhov
5057e0aa 4268a06b

+6 -6
+6 -6
drivers/input/misc/stpmic1_onkey.c
··· 142 142 return 0; 143 143 } 144 144 145 - static int __maybe_unused stpmic1_onkey_suspend(struct device *dev) 145 + static int stpmic1_onkey_suspend(struct device *dev) 146 146 { 147 147 struct platform_device *pdev = to_platform_device(dev); 148 148 struct stpmic1_onkey *onkey = platform_get_drvdata(pdev); ··· 154 154 return 0; 155 155 } 156 156 157 - static int __maybe_unused stpmic1_onkey_resume(struct device *dev) 157 + static int stpmic1_onkey_resume(struct device *dev) 158 158 { 159 159 struct platform_device *pdev = to_platform_device(dev); 160 160 struct stpmic1_onkey *onkey = platform_get_drvdata(pdev); ··· 166 166 return 0; 167 167 } 168 168 169 - static SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm, 170 - stpmic1_onkey_suspend, 171 - stpmic1_onkey_resume); 169 + static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_onkey_pm, 170 + stpmic1_onkey_suspend, 171 + stpmic1_onkey_resume); 172 172 173 173 static const struct of_device_id of_stpmic1_onkey_match[] = { 174 174 { .compatible = "st,stpmic1-onkey" }, ··· 182 182 .driver = { 183 183 .name = "stpmic1_onkey", 184 184 .of_match_table = of_match_ptr(of_stpmic1_onkey_match), 185 - .pm = &stpmic1_onkey_pm, 185 + .pm = pm_sleep_ptr(&stpmic1_onkey_pm), 186 186 }, 187 187 }; 188 188 module_platform_driver(stpmic1_onkey_driver);