提交 b904854e 编写于 作者: J Jonathan Cameron

iio: light: vcnl4035: 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: NJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: NPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-34-jic23@kernel.org
上级 cd4d10b1
...@@ -620,7 +620,7 @@ static int vcnl4035_remove(struct i2c_client *client) ...@@ -620,7 +620,7 @@ static int vcnl4035_remove(struct i2c_client *client)
return 0; return 0;
} }
static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev) static int vcnl4035_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));
struct vcnl4035_data *data = iio_priv(indio_dev); struct vcnl4035_data *data = iio_priv(indio_dev);
...@@ -632,7 +632,7 @@ static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev) ...@@ -632,7 +632,7 @@ static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev)
return ret; return ret;
} }
static int __maybe_unused vcnl4035_runtime_resume(struct device *dev) static int vcnl4035_runtime_resume(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));
struct vcnl4035_data *data = iio_priv(indio_dev); struct vcnl4035_data *data = iio_priv(indio_dev);
...@@ -649,12 +649,8 @@ static int __maybe_unused vcnl4035_runtime_resume(struct device *dev) ...@@ -649,12 +649,8 @@ static int __maybe_unused vcnl4035_runtime_resume(struct device *dev)
return 0; return 0;
} }
static const struct dev_pm_ops vcnl4035_pm_ops = { static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4035_pm_ops, vcnl4035_runtime_suspend,
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, vcnl4035_runtime_resume, NULL);
pm_runtime_force_resume)
SET_RUNTIME_PM_OPS(vcnl4035_runtime_suspend,
vcnl4035_runtime_resume, NULL)
};
static const struct i2c_device_id vcnl4035_id[] = { static const struct i2c_device_id vcnl4035_id[] = {
{ "vcnl4035", 0 }, { "vcnl4035", 0 },
...@@ -671,7 +667,7 @@ MODULE_DEVICE_TABLE(of, vcnl4035_of_match); ...@@ -671,7 +667,7 @@ MODULE_DEVICE_TABLE(of, vcnl4035_of_match);
static struct i2c_driver vcnl4035_driver = { static struct i2c_driver vcnl4035_driver = {
.driver = { .driver = {
.name = VCNL4035_DRV_NAME, .name = VCNL4035_DRV_NAME,
.pm = &vcnl4035_pm_ops, .pm = pm_ptr(&vcnl4035_pm_ops),
.of_match_table = vcnl4035_of_match, .of_match_table = vcnl4035_of_match,
}, },
.probe = vcnl4035_probe, .probe = vcnl4035_probe,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册