i2c: rcar: Remove #ifdef guards for PM related functions
authorPaul Cercueil <paul@crapouillou.net>
Sat, 22 Jul 2023 11:53:06 +0000 (13:53 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 8 Aug 2023 13:36:51 +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>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20230722115310.27681-2-paul@crapouillou.net
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-rcar.c

index 2d9c37410ebd0f1f397d91b3589b28b2bcdcf954..6b7f0f27d0c3c39614be0c5645a1c00be63dd981 100644 (file)
@@ -1169,7 +1169,6 @@ static void rcar_i2c_remove(struct platform_device *pdev)
        pm_runtime_disable(dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int rcar_i2c_suspend(struct device *dev)
 {
        struct rcar_i2c_priv *priv = dev_get_drvdata(dev);
@@ -1187,19 +1186,14 @@ static int rcar_i2c_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops rcar_i2c_pm_ops = {
-       SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(rcar_i2c_suspend, rcar_i2c_resume)
+       NOIRQ_SYSTEM_SLEEP_PM_OPS(rcar_i2c_suspend, rcar_i2c_resume)
 };
 
-#define DEV_PM_OPS (&rcar_i2c_pm_ops)
-#else
-#define DEV_PM_OPS NULL
-#endif /* CONFIG_PM_SLEEP */
-
 static struct platform_driver rcar_i2c_driver = {
        .driver = {
                .name   = "i2c-rcar",
                .of_match_table = rcar_i2c_dt_ids,
-               .pm     = DEV_PM_OPS,
+               .pm     = pm_sleep_ptr(&rcar_i2c_pm_ops),
        },
        .probe          = rcar_i2c_probe,
        .remove_new     = rcar_i2c_remove,