Commit ae73d91e authored by Jonathan Cameron's avatar Jonathan Cameron

iio:proximity:pulsedlight: 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-48-jic23@kernel.org
parent ea087612
...@@ -338,7 +338,6 @@ static const struct of_device_id lidar_dt_ids[] = { ...@@ -338,7 +338,6 @@ static const struct of_device_id lidar_dt_ids[] = {
}; };
MODULE_DEVICE_TABLE(of, lidar_dt_ids); MODULE_DEVICE_TABLE(of, lidar_dt_ids);
#ifdef CONFIG_PM
static int lidar_pm_runtime_suspend(struct device *dev) static int lidar_pm_runtime_suspend(struct device *dev)
{ {
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
...@@ -358,18 +357,16 @@ static int lidar_pm_runtime_resume(struct device *dev) ...@@ -358,18 +357,16 @@ static int lidar_pm_runtime_resume(struct device *dev)
return ret; return ret;
} }
#endif
static const struct dev_pm_ops lidar_pm_ops = { static const struct dev_pm_ops lidar_pm_ops = {
SET_RUNTIME_PM_OPS(lidar_pm_runtime_suspend, RUNTIME_PM_OPS(lidar_pm_runtime_suspend, lidar_pm_runtime_resume, NULL)
lidar_pm_runtime_resume, NULL)
}; };
static struct i2c_driver lidar_driver = { static struct i2c_driver lidar_driver = {
.driver = { .driver = {
.name = LIDAR_DRV_NAME, .name = LIDAR_DRV_NAME,
.of_match_table = lidar_dt_ids, .of_match_table = lidar_dt_ids,
.pm = &lidar_pm_ops, .pm = pm_ptr(&lidar_pm_ops),
}, },
.probe = lidar_probe, .probe = lidar_probe,
.remove = lidar_remove, .remove = lidar_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