diff options
author | Paul Cercueil <paul@crapouillou.net> | 2023-07-22 13:50:35 +0200 |
---|---|---|
committer | Andi Shyti <andi.shyti@kernel.org> | 2023-08-08 15:36:49 +0200 |
commit | 9f38edaf4a005a2f435aa5e5ad8ee2e9fc4e3379 (patch) | |
tree | 3573d233e86fa039b6a33e2aaf43b30aa3df91b7 /drivers/i2c/busses/i2c-lpc2k.c | |
parent | i2c: kempld: Convert to use regular device PM (diff) | |
download | linux-9f38edaf4a005a2f435aa5e5ad8ee2e9fc4e3379.tar.xz linux-9f38edaf4a005a2f435aa5e5ad8ee2e9fc4e3379.zip |
i2c: lpc2k: Remove #ifdef guards for PM related functions
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.
Note that the behaviour is slightly different than before; the original
code wrapped the suspend/resume with #ifdef CONFIG_PM guards, which
resulted in these functions being compiled in but never used when
CONFIG_PM_SLEEP was disabled.
Now, those functions are only compiled in when CONFIG_PM_SLEEP is
enabled.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20230722115046.27323-12-paul@crapouillou.net
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-lpc2k.c')
-rw-r--r-- | drivers/i2c/busses/i2c-lpc2k.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c index 5c6d96554753..c61157f1409b 100644 --- a/drivers/i2c/busses/i2c-lpc2k.c +++ b/drivers/i2c/busses/i2c-lpc2k.c @@ -431,7 +431,6 @@ static void i2c_lpc2k_remove(struct platform_device *dev) i2c_del_adapter(&i2c->adap); } -#ifdef CONFIG_PM static int i2c_lpc2k_suspend(struct device *dev) { struct lpc2k_i2c *i2c = dev_get_drvdata(dev); @@ -456,11 +455,6 @@ static const struct dev_pm_ops i2c_lpc2k_dev_pm_ops = { .resume_noirq = i2c_lpc2k_resume, }; -#define I2C_LPC2K_DEV_PM_OPS (&i2c_lpc2k_dev_pm_ops) -#else -#define I2C_LPC2K_DEV_PM_OPS NULL -#endif - static const struct of_device_id lpc2k_i2c_match[] = { { .compatible = "nxp,lpc1788-i2c" }, {}, @@ -472,7 +466,7 @@ static struct platform_driver i2c_lpc2k_driver = { .remove_new = i2c_lpc2k_remove, .driver = { .name = "lpc2k-i2c", - .pm = I2C_LPC2K_DEV_PM_OPS, + .pm = pm_sleep_ptr(&i2c_lpc2k_dev_pm_ops), .of_match_table = lpc2k_i2c_match, }, }; |