From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> 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@xxxxxxxxxx> Cc: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx> --- drivers/iio/chemical/atlas-sensor.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 04b44a327614..7bacd0bd6f19 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, -- 2.34.0