summaryrefslogtreecommitdiff
path: root/drivers/iio/light
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2022-06-21 21:27:15 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-07-18 18:48:19 +0100
commitcd4d10b134c2194c50dc7f58c1f9c502f7f76656 (patch)
tree4678c2fc069e310c98d585c56f88383221c33a32 /drivers/iio/light
parent5672f3982ac98c8a8b8f1c5d4e2b3cd03342ea9d (diff)
iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
Using these new macros allows the compiler to remove the unused dev_pm_ops structure and related functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Mathieu Othacehe <m.othacehe@gmail.com> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20220621202719.13644-33-jic23@kernel.org
Diffstat (limited to 'drivers/iio/light')
-rw-r--r--drivers/iio/light/vcnl4000.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 947a41b86173..3db4e26731bb 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -1130,7 +1130,7 @@ static int vcnl4000_remove(struct i2c_client *client)
return 0;
}
-static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev)
+static int vcnl4000_runtime_suspend(struct device *dev)
{
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
struct vcnl4000_data *data = iio_priv(indio_dev);
@@ -1138,7 +1138,7 @@ static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev)
return data->chip_spec->set_power_state(data, false);
}
-static int __maybe_unused vcnl4000_runtime_resume(struct device *dev)
+static int vcnl4000_runtime_resume(struct device *dev)
{
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
struct vcnl4000_data *data = iio_priv(indio_dev);
@@ -1146,17 +1146,13 @@ static int __maybe_unused vcnl4000_runtime_resume(struct device *dev)
return data->chip_spec->set_power_state(data, true);
}
-static const struct dev_pm_ops vcnl4000_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
- SET_RUNTIME_PM_OPS(vcnl4000_runtime_suspend,
- vcnl4000_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4000_pm_ops, vcnl4000_runtime_suspend,
+ vcnl4000_runtime_resume, NULL);
static struct i2c_driver vcnl4000_driver = {
.driver = {
.name = VCNL4000_DRV_NAME,
- .pm = &vcnl4000_pm_ops,
+ .pm = pm_ptr(&vcnl4000_pm_ops),
.of_match_table = vcnl_4000_of_match,
},
.probe = vcnl4000_probe,