Commit 05a9ddc8 authored by Jonathan Cameron's avatar Jonathan Cameron

iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc

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.
Acked-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
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-49-jic23@kernel.org
parent ae73d91e
...@@ -737,7 +737,6 @@ static int atlas_remove(struct i2c_client *client) ...@@ -737,7 +737,6 @@ static int atlas_remove(struct i2c_client *client)
return atlas_set_powermode(data, 0); return atlas_set_powermode(data, 0);
} }
#ifdef CONFIG_PM
static int atlas_runtime_suspend(struct device *dev) static int atlas_runtime_suspend(struct device *dev)
{ {
struct atlas_data *data = struct atlas_data *data =
...@@ -753,18 +752,16 @@ static int atlas_runtime_resume(struct device *dev) ...@@ -753,18 +752,16 @@ static int atlas_runtime_resume(struct device *dev)
return atlas_set_powermode(data, 1); return atlas_set_powermode(data, 1);
} }
#endif
static const struct dev_pm_ops atlas_pm_ops = { static const struct dev_pm_ops atlas_pm_ops = {
SET_RUNTIME_PM_OPS(atlas_runtime_suspend, RUNTIME_PM_OPS(atlas_runtime_suspend, atlas_runtime_resume, NULL)
atlas_runtime_resume, NULL)
}; };
static struct i2c_driver atlas_driver = { static struct i2c_driver atlas_driver = {
.driver = { .driver = {
.name = ATLAS_DRV_NAME, .name = ATLAS_DRV_NAME,
.of_match_table = atlas_dt_ids, .of_match_table = atlas_dt_ids,
.pm = &atlas_pm_ops, .pm = pm_ptr(&atlas_pm_ops),
}, },
.probe = atlas_probe, .probe = atlas_probe,
.remove = atlas_remove, .remove = atlas_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