Commit dce97f81 authored by Paul Cercueil's avatar Paul Cercueil Committed by Lee Jones

mfd: aat2870: Remove #ifdef guards for PM related functions

Use the new DEFINE_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: default avatarPaul Cercueil <paul@crapouillou.net>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent 19755a0a
...@@ -408,7 +408,6 @@ static int aat2870_i2c_probe(struct i2c_client *client) ...@@ -408,7 +408,6 @@ static int aat2870_i2c_probe(struct i2c_client *client)
return ret; return ret;
} }
#ifdef CONFIG_PM_SLEEP
static int aat2870_i2c_suspend(struct device *dev) static int aat2870_i2c_suspend(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
...@@ -437,10 +436,9 @@ static int aat2870_i2c_resume(struct device *dev) ...@@ -437,10 +436,9 @@ static int aat2870_i2c_resume(struct device *dev)
return 0; return 0;
} }
#endif /* CONFIG_PM_SLEEP */
static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend,
aat2870_i2c_resume); aat2870_i2c_resume);
static const struct i2c_device_id aat2870_i2c_id_table[] = { static const struct i2c_device_id aat2870_i2c_id_table[] = {
{ "aat2870", 0 }, { "aat2870", 0 },
...@@ -450,7 +448,7 @@ static const struct i2c_device_id aat2870_i2c_id_table[] = { ...@@ -450,7 +448,7 @@ static const struct i2c_device_id aat2870_i2c_id_table[] = {
static struct i2c_driver aat2870_i2c_driver = { static struct i2c_driver aat2870_i2c_driver = {
.driver = { .driver = {
.name = "aat2870", .name = "aat2870",
.pm = &aat2870_pm_ops, .pm = pm_sleep_ptr(&aat2870_pm_ops),
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe_new = aat2870_i2c_probe, .probe_new = aat2870_i2c_probe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment