i2c: img-scb: Remove #ifdef guards for PM related functions
authorPaul Cercueil <paul@crapouillou.net>
Sat, 22 Jul 2023 11:50:33 +0000 (13:50 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 8 Aug 2023 13:36:49 +0000 (15:36 +0200)
Use the new PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20230722115046.27323-10-paul@crapouillou.net
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-img-scb.c

index 66ba36949ab59c0414fd3df004aec219aa67013c..f9d4bfef511c3067dd0359b42152719f6c353f0f 100644 (file)
@@ -1454,7 +1454,6 @@ static int img_i2c_runtime_resume(struct device *dev)
        return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int img_i2c_suspend(struct device *dev)
 {
        struct img_i2c *i2c = dev_get_drvdata(dev);
@@ -1482,13 +1481,10 @@ static int img_i2c_resume(struct device *dev)
 
        return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops img_i2c_pm = {
-       SET_RUNTIME_PM_OPS(img_i2c_runtime_suspend,
-                          img_i2c_runtime_resume,
-                          NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(img_i2c_suspend, img_i2c_resume)
+       RUNTIME_PM_OPS(img_i2c_runtime_suspend, img_i2c_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(img_i2c_suspend, img_i2c_resume)
 };
 
 static const struct of_device_id img_scb_i2c_match[] = {
@@ -1501,7 +1497,7 @@ static struct platform_driver img_scb_i2c_driver = {
        .driver = {
                .name           = "img-i2c-scb",
                .of_match_table = img_scb_i2c_match,
-               .pm             = &img_i2c_pm,
+               .pm             = pm_ptr(&img_i2c_pm),
        },
        .probe = img_i2c_probe,
        .remove_new = img_i2c_remove,