diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-11-21 18:55:16 +0000 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-11-23 19:13:02 +0000 |
commit | 10240452420c8b0c8d37ceee39bab44df21082dc (patch) | |
tree | be4127e055cf472c012882212103b9d1d262f27f | |
parent | 7eeafb5485c96b0501318ad33f84d8302cf1102b (diff) | |
download | iio-pm_guards.tar.gz |
iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unusedpm_guards
Letting the compiler remove these functions when the kernel is built
without CONFIG_PM 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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r-- | drivers/iio/chemical/atlas-sensor.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 04b44a327614f..7bacd0bd6f19c 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -737,8 +737,7 @@ static int atlas_remove(struct i2c_client *client) return atlas_set_powermode(data, 0); } -#ifdef CONFIG_PM -static int atlas_runtime_suspend(struct device *dev) +static __maybe_unused int atlas_runtime_suspend(struct device *dev) { struct atlas_data *data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); @@ -746,16 +745,15 @@ static int atlas_runtime_suspend(struct device *dev) return atlas_set_powermode(data, 0); } -static int atlas_runtime_resume(struct device *dev) +static __maybe_unused int atlas_runtime_resume(struct device *dev) { struct atlas_data *data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); return atlas_set_powermode(data, 1); } -#endif -static const struct dev_pm_ops atlas_pm_ops = { +static __maybe_unused const struct dev_pm_ops atlas_pm_ops = { SET_RUNTIME_PM_OPS(atlas_runtime_suspend, atlas_runtime_resume, NULL) }; @@ -764,7 +762,7 @@ static struct i2c_driver atlas_driver = { .driver = { .name = ATLAS_DRV_NAME, .of_match_table = atlas_dt_ids, - .pm = &atlas_pm_ops, + .pm = pm_ptr(&atlas_pm_ops), }, .probe = atlas_probe, .remove = atlas_remove, |