i2c: nomadik: 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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230722115046.27323-14-paul@crapouillou.net
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
Paul Cercueil 2023-07-22 13:50:37 +02:00 committed by Andi Shyti
parent ba733668dc
commit e159fe0d0c

View File

@ -873,7 +873,6 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
#ifdef CONFIG_PM_SLEEP
static int nmk_i2c_suspend_late(struct device *dev) static int nmk_i2c_suspend_late(struct device *dev)
{ {
int ret; int ret;
@ -890,9 +889,7 @@ static int nmk_i2c_resume_early(struct device *dev)
{ {
return pm_runtime_force_resume(dev); return pm_runtime_force_resume(dev);
} }
#endif
#ifdef CONFIG_PM
static int nmk_i2c_runtime_suspend(struct device *dev) static int nmk_i2c_runtime_suspend(struct device *dev)
{ {
struct amba_device *adev = to_amba_device(dev); struct amba_device *adev = to_amba_device(dev);
@ -925,13 +922,10 @@ static int nmk_i2c_runtime_resume(struct device *dev)
return ret; return ret;
} }
#endif
static const struct dev_pm_ops nmk_i2c_pm = { static const struct dev_pm_ops nmk_i2c_pm = {
SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early) LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
SET_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend, RUNTIME_PM_OPS(nmk_i2c_runtime_suspend, nmk_i2c_runtime_resume, NULL)
nmk_i2c_runtime_resume,
NULL)
}; };
static unsigned int nmk_i2c_functionality(struct i2c_adapter *adap) static unsigned int nmk_i2c_functionality(struct i2c_adapter *adap)
@ -1078,7 +1072,7 @@ static struct amba_driver nmk_i2c_driver = {
.drv = { .drv = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = DRIVER_NAME, .name = DRIVER_NAME,
.pm = &nmk_i2c_pm, .pm = pm_ptr(&nmk_i2c_pm),
}, },
.id_table = nmk_i2c_ids, .id_table = nmk_i2c_ids,
.probe = nmk_i2c_probe, .probe = nmk_i2c_probe,