Input: mtk-pmic-keys - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 4 Dec 2022 18:08:18 +0000 (18:08 +0000)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 7 Dec 2022 21:27:10 +0000 (13:27 -0800)
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: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20221204180841.2211588-10-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/mtk-pmic-keys.c

index 9b34da0ec260507b3d2efaef0d9e084b891e5a60..3d4ffa25e3df45d9dbc9dcbbfc5087276cbc0c0e 100644 (file)
@@ -231,7 +231,7 @@ static int mtk_pmic_key_setup(struct mtk_pmic_keys *keys,
        return 0;
 }
 
-static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev)
+static int mtk_pmic_keys_suspend(struct device *dev)
 {
        struct mtk_pmic_keys *keys = dev_get_drvdata(dev);
        int index;
@@ -247,7 +247,7 @@ static int __maybe_unused mtk_pmic_keys_suspend(struct device *dev)
        return 0;
 }
 
-static int __maybe_unused mtk_pmic_keys_resume(struct device *dev)
+static int mtk_pmic_keys_resume(struct device *dev)
 {
        struct mtk_pmic_keys *keys = dev_get_drvdata(dev);
        int index;
@@ -263,8 +263,8 @@ static int __maybe_unused mtk_pmic_keys_resume(struct device *dev)
        return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(mtk_pmic_keys_pm_ops, mtk_pmic_keys_suspend,
-                       mtk_pmic_keys_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_pmic_keys_pm_ops, mtk_pmic_keys_suspend,
+                               mtk_pmic_keys_resume);
 
 static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
        {
@@ -387,7 +387,7 @@ static struct platform_driver pmic_keys_pdrv = {
        .driver = {
                   .name = "mtk-pmic-keys",
                   .of_match_table = of_mtk_pmic_keys_match_tbl,
-                  .pm = &mtk_pmic_keys_pm_ops,
+                  .pm = pm_sleep_ptr(&mtk_pmic_keys_pm_ops),
        },
 };