Input: lm8323 - switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 4 Dec 2022 18:08:22 +0000 (18:08 +0000)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 7 Dec 2022 21:27:28 +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 ifdef guards.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20221204180841.2211588-14-jic23@kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/lm8323.c

index 4846ecc..5df4d5a 100644 (file)
@@ -770,7 +770,6 @@ static void lm8323_remove(struct i2c_client *client)
        kfree(lm);
 }
 
-#ifdef CONFIG_PM_SLEEP
 /*
  * We don't need to explicitly suspend the chip, as it already switches off
  * when there's no activity.
@@ -814,9 +813,8 @@ static int lm8323_resume(struct device *dev)
 
        return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(lm8323_pm_ops, lm8323_suspend, lm8323_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(lm8323_pm_ops, lm8323_suspend, lm8323_resume);
 
 static const struct i2c_device_id lm8323_id[] = {
        { "lm8323", 0 },
@@ -826,7 +824,7 @@ static const struct i2c_device_id lm8323_id[] = {
 static struct i2c_driver lm8323_i2c_driver = {
        .driver = {
                .name   = "lm8323",
-               .pm     = &lm8323_pm_ops,
+               .pm     = pm_sleep_ptr(&lm8323_pm_ops),
        },
        .probe_new      = lm8323_probe,
        .remove         = lm8323_remove,