OSDN Git Service

Input: ambakmi - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 2 Jan 2023 18:18:02 +0000 (18:18 +0000)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 10 Jan 2023 04:25:23 +0000 (20:25 -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: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230102181842.718010-30-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/serio/ambakmi.c

index c391700..8fbfa44 100644 (file)
@@ -170,7 +170,7 @@ static void amba_kmi_remove(struct amba_device *dev)
        amba_release_regions(dev);
 }
 
-static int __maybe_unused amba_kmi_resume(struct device *dev)
+static int amba_kmi_resume(struct device *dev)
 {
        struct amba_kmi_port *kmi = dev_get_drvdata(dev);
 
@@ -180,7 +180,7 @@ static int __maybe_unused amba_kmi_resume(struct device *dev)
        return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(amba_kmi_dev_pm_ops, NULL, amba_kmi_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(amba_kmi_dev_pm_ops, NULL, amba_kmi_resume);
 
 static const struct amba_id amba_kmi_idtable[] = {
        {
@@ -196,7 +196,7 @@ static struct amba_driver ambakmi_driver = {
        .drv            = {
                .name   = "kmi-pl050",
                .owner  = THIS_MODULE,
-               .pm     = &amba_kmi_dev_pm_ops,
+               .pm     = pm_sleep_ptr(&amba_kmi_dev_pm_ops),
        },
        .id_table       = amba_kmi_idtable,
        .probe          = amba_kmi_probe,