Commit e9b76712 authored by Jonathan Cameron's avatar Jonathan Cameron

iio:light:isl29125: 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 avatarPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-22-jic23@kernel.org
parent b020281d
...@@ -311,7 +311,6 @@ static int isl29125_remove(struct i2c_client *client) ...@@ -311,7 +311,6 @@ static int isl29125_remove(struct i2c_client *client)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int isl29125_suspend(struct device *dev) static int isl29125_suspend(struct device *dev)
{ {
struct isl29125_data *data = iio_priv(i2c_get_clientdata( struct isl29125_data *data = iio_priv(i2c_get_clientdata(
...@@ -326,9 +325,9 @@ static int isl29125_resume(struct device *dev) ...@@ -326,9 +325,9 @@ static int isl29125_resume(struct device *dev)
return i2c_smbus_write_byte_data(data->client, ISL29125_CONF1, return i2c_smbus_write_byte_data(data->client, ISL29125_CONF1,
data->conf1); data->conf1);
} }
#endif
static SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend, isl29125_resume); static DEFINE_SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend,
isl29125_resume);
static const struct i2c_device_id isl29125_id[] = { static const struct i2c_device_id isl29125_id[] = {
{ "isl29125", 0 }, { "isl29125", 0 },
...@@ -339,7 +338,7 @@ MODULE_DEVICE_TABLE(i2c, isl29125_id); ...@@ -339,7 +338,7 @@ MODULE_DEVICE_TABLE(i2c, isl29125_id);
static struct i2c_driver isl29125_driver = { static struct i2c_driver isl29125_driver = {
.driver = { .driver = {
.name = ISL29125_DRV_NAME, .name = ISL29125_DRV_NAME,
.pm = &isl29125_pm_ops, .pm = pm_sleep_ptr(&isl29125_pm_ops),
}, },
.probe = isl29125_probe, .probe = isl29125_probe,
.remove = isl29125_remove, .remove = isl29125_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