mfd: 88pm80x: Remove #ifdef guards for PM related functions

Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is 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>
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
Paul Cercueil 2022-10-23 10:48:25 +01:00 committed by Lee Jones
parent 3f37d4f695
commit 19755a0acb
3 changed files with 3 additions and 6 deletions

View File

@ -596,7 +596,7 @@ static void pm800_remove(struct i2c_client *client)
static struct i2c_driver pm800_driver = {
.driver = {
.name = "88PM800",
.pm = &pm80x_pm_ops,
.pm = pm_sleep_ptr(&pm80x_pm_ops),
},
.probe_new = pm800_probe,
.remove = pm800_remove,

View File

@ -251,7 +251,7 @@ static void pm805_remove(struct i2c_client *client)
static struct i2c_driver pm805_driver = {
.driver = {
.name = "88PM805",
.pm = &pm80x_pm_ops,
.pm = pm_sleep_ptr(&pm80x_pm_ops),
},
.probe_new = pm805_probe,
.remove = pm805_remove,

View File

@ -129,7 +129,6 @@ int pm80x_deinit(void)
}
EXPORT_SYMBOL_GPL(pm80x_deinit);
#ifdef CONFIG_PM_SLEEP
static int pm80x_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@ -153,10 +152,8 @@ static int pm80x_resume(struct device *dev)
return 0;
}
#endif
SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume);
EXPORT_SYMBOL_GPL(pm80x_pm_ops);
EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume);
MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x");
MODULE_AUTHOR("Qiao Zhou <zhouqiao@marvell.com>");