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

iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()

Using these new macros allows removal of unused pm_ops structure
and functions if !CONFIG_PM without the need to mark the function
__maybe_unused.
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Brian Masney <masneyb@onstation.org>
Reviewed-by: NBrian Masney <masneyb@onstation.org>
Reviewed-by: NPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-31-jic23@kernel.org
上级 9ec91dd4
...@@ -888,7 +888,7 @@ static int tsl2583_remove(struct i2c_client *client) ...@@ -888,7 +888,7 @@ static int tsl2583_remove(struct i2c_client *client)
return 0; return 0;
} }
static int __maybe_unused tsl2583_suspend(struct device *dev) static int tsl2583_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 tsl2583_chip *chip = iio_priv(indio_dev); struct tsl2583_chip *chip = iio_priv(indio_dev);
...@@ -903,7 +903,7 @@ static int __maybe_unused tsl2583_suspend(struct device *dev) ...@@ -903,7 +903,7 @@ static int __maybe_unused tsl2583_suspend(struct device *dev)
return ret; return ret;
} }
static int __maybe_unused tsl2583_resume(struct device *dev) static int tsl2583_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 tsl2583_chip *chip = iio_priv(indio_dev); struct tsl2583_chip *chip = iio_priv(indio_dev);
...@@ -918,11 +918,8 @@ static int __maybe_unused tsl2583_resume(struct device *dev) ...@@ -918,11 +918,8 @@ static int __maybe_unused tsl2583_resume(struct device *dev)
return ret; return ret;
} }
static const struct dev_pm_ops tsl2583_pm_ops = { static DEFINE_RUNTIME_DEV_PM_OPS(tsl2583_pm_ops, tsl2583_suspend,
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, tsl2583_resume, NULL);
pm_runtime_force_resume)
SET_RUNTIME_PM_OPS(tsl2583_suspend, tsl2583_resume, NULL)
};
static const struct i2c_device_id tsl2583_idtable[] = { static const struct i2c_device_id tsl2583_idtable[] = {
{ "tsl2580", 0 }, { "tsl2580", 0 },
...@@ -944,7 +941,7 @@ MODULE_DEVICE_TABLE(of, tsl2583_of_match); ...@@ -944,7 +941,7 @@ MODULE_DEVICE_TABLE(of, tsl2583_of_match);
static struct i2c_driver tsl2583_driver = { static struct i2c_driver tsl2583_driver = {
.driver = { .driver = {
.name = "tsl2583", .name = "tsl2583",
.pm = &tsl2583_pm_ops, .pm = pm_ptr(&tsl2583_pm_ops),
.of_match_table = tsl2583_of_match, .of_match_table = tsl2583_of_match,
}, },
.id_table = tsl2583_idtable, .id_table = tsl2583_idtable,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册