mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 08:34:20 +08:00
i2c: pxa: 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-17-paul@crapouillou.net Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
parent
6184f92fb1
commit
1ea4e6b56e
@ -1491,7 +1491,6 @@ static void i2c_pxa_remove(struct platform_device *dev)
|
|||||||
clk_disable_unprepare(i2c->clk);
|
clk_disable_unprepare(i2c->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
|
||||||
static int i2c_pxa_suspend_noirq(struct device *dev)
|
static int i2c_pxa_suspend_noirq(struct device *dev)
|
||||||
{
|
{
|
||||||
struct pxa_i2c *i2c = dev_get_drvdata(dev);
|
struct pxa_i2c *i2c = dev_get_drvdata(dev);
|
||||||
@ -1516,17 +1515,12 @@ static const struct dev_pm_ops i2c_pxa_dev_pm_ops = {
|
|||||||
.resume_noirq = i2c_pxa_resume_noirq,
|
.resume_noirq = i2c_pxa_resume_noirq,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define I2C_PXA_DEV_PM_OPS (&i2c_pxa_dev_pm_ops)
|
|
||||||
#else
|
|
||||||
#define I2C_PXA_DEV_PM_OPS NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct platform_driver i2c_pxa_driver = {
|
static struct platform_driver i2c_pxa_driver = {
|
||||||
.probe = i2c_pxa_probe,
|
.probe = i2c_pxa_probe,
|
||||||
.remove_new = i2c_pxa_remove,
|
.remove_new = i2c_pxa_remove,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "pxa2xx-i2c",
|
.name = "pxa2xx-i2c",
|
||||||
.pm = I2C_PXA_DEV_PM_OPS,
|
.pm = pm_sleep_ptr(&i2c_pxa_dev_pm_ops),
|
||||||
.of_match_table = i2c_pxa_dt_ids,
|
.of_match_table = i2c_pxa_dt_ids,
|
||||||
},
|
},
|
||||||
.id_table = i2c_pxa_id_table,
|
.id_table = i2c_pxa_id_table,
|
||||||
|
Loading…
Reference in New Issue
Block a user