Commit 4929ddd0 authored by Jonathan Cameron's avatar Jonathan Cameron

iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based config guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-6-jic23@kernel.org
parent 50bc5e78
...@@ -160,7 +160,6 @@ static int mc3230_remove(struct i2c_client *client) ...@@ -160,7 +160,6 @@ static int mc3230_remove(struct i2c_client *client)
return mc3230_set_opcon(iio_priv(indio_dev), MC3230_MODE_OPCON_STANDBY); return mc3230_set_opcon(iio_priv(indio_dev), MC3230_MODE_OPCON_STANDBY);
} }
#ifdef CONFIG_PM_SLEEP
static int mc3230_suspend(struct device *dev) static int mc3230_suspend(struct device *dev)
{ {
struct mc3230_data *data; struct mc3230_data *data;
...@@ -178,9 +177,8 @@ static int mc3230_resume(struct device *dev) ...@@ -178,9 +177,8 @@ static int mc3230_resume(struct device *dev)
return mc3230_set_opcon(data, MC3230_MODE_OPCON_WAKE); return mc3230_set_opcon(data, MC3230_MODE_OPCON_WAKE);
} }
#endif
static SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume); static DEFINE_SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume);
static const struct i2c_device_id mc3230_i2c_id[] = { static const struct i2c_device_id mc3230_i2c_id[] = {
{"mc3230", 0}, {"mc3230", 0},
...@@ -191,7 +189,7 @@ MODULE_DEVICE_TABLE(i2c, mc3230_i2c_id); ...@@ -191,7 +189,7 @@ MODULE_DEVICE_TABLE(i2c, mc3230_i2c_id);
static struct i2c_driver mc3230_driver = { static struct i2c_driver mc3230_driver = {
.driver = { .driver = {
.name = "mc3230", .name = "mc3230",
.pm = &mc3230_pm_ops, .pm = pm_sleep_ptr(&mc3230_pm_ops),
}, },
.probe = mc3230_probe, .probe = mc3230_probe,
.remove = mc3230_remove, .remove = mc3230_remove,
......
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