]> Git Repo - J-linux.git/commitdiff
iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc
authorJonathan Cameron <[email protected]>
Sun, 30 Jan 2022 19:31:45 +0000 (19:31 +0000)
committerJonathan Cameron <[email protected]>
Mon, 21 Feb 2022 19:33:04 +0000 (19:33 +0000)
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: Matt Ranostay <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Paul Cercueil <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
drivers/iio/chemical/atlas-sensor.c

index a8211dd20b350bd59612276b2f3d62457897d584..56dea9734c8de13ba5d0d4ee11677f7f6884f63a 100644 (file)
@@ -737,7 +737,6 @@ 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)
 {
        struct atlas_data *data =
@@ -753,18 +752,16 @@ static int atlas_runtime_resume(struct device *dev)
 
        return atlas_set_powermode(data, 1);
 }
-#endif
 
 static const struct dev_pm_ops atlas_pm_ops = {
-       SET_RUNTIME_PM_OPS(atlas_runtime_suspend,
-                          atlas_runtime_resume, NULL)
+       RUNTIME_PM_OPS(atlas_runtime_suspend, atlas_runtime_resume, NULL)
 };
 
 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,
This page took 0.061364 seconds and 4 git commands to generate.