提交 5672f398 编写于 作者: J Jonathan Cameron

iio: light: tsl2591: 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 functions
__maybe_unused.
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Joe Sandom <joe.g.sandom@gmail.com>
Reviewed-by: NPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-32-jic23@kernel.org
上级 f541541a
...@@ -1019,7 +1019,7 @@ static const struct iio_info tsl2591_info_no_irq = { ...@@ -1019,7 +1019,7 @@ static const struct iio_info tsl2591_info_no_irq = {
.read_avail = tsl2591_read_available, .read_avail = tsl2591_read_available,
}; };
static int __maybe_unused tsl2591_suspend(struct device *dev) static int tsl2591_suspend(struct device *dev)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct tsl2591_chip *chip = iio_priv(indio_dev); struct tsl2591_chip *chip = iio_priv(indio_dev);
...@@ -1032,7 +1032,7 @@ static int __maybe_unused tsl2591_suspend(struct device *dev) ...@@ -1032,7 +1032,7 @@ static int __maybe_unused tsl2591_suspend(struct device *dev)
return ret; return ret;
} }
static int __maybe_unused tsl2591_resume(struct device *dev) static int tsl2591_resume(struct device *dev)
{ {
int power_state = TSL2591_PWR_ON | TSL2591_ENABLE_ALS; int power_state = TSL2591_PWR_ON | TSL2591_ENABLE_ALS;
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
...@@ -1049,10 +1049,8 @@ static int __maybe_unused tsl2591_resume(struct device *dev) ...@@ -1049,10 +1049,8 @@ static int __maybe_unused tsl2591_resume(struct device *dev)
return ret; return ret;
} }
static const struct dev_pm_ops tsl2591_pm_ops = { static DEFINE_RUNTIME_DEV_PM_OPS(tsl2591_pm_ops, tsl2591_suspend,
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) tsl2591_resume, NULL);
SET_RUNTIME_PM_OPS(tsl2591_suspend, tsl2591_resume, NULL)
};
static irqreturn_t tsl2591_event_handler(int irq, void *private) static irqreturn_t tsl2591_event_handler(int irq, void *private)
{ {
...@@ -1213,7 +1211,7 @@ MODULE_DEVICE_TABLE(of, tsl2591_of_match); ...@@ -1213,7 +1211,7 @@ MODULE_DEVICE_TABLE(of, tsl2591_of_match);
static struct i2c_driver tsl2591_driver = { static struct i2c_driver tsl2591_driver = {
.driver = { .driver = {
.name = "tsl2591", .name = "tsl2591",
.pm = &tsl2591_pm_ops, .pm = pm_ptr(&tsl2591_pm_ops),
.of_match_table = tsl2591_of_match, .of_match_table = tsl2591_of_match,
}, },
.probe_new = tsl2591_probe .probe_new = tsl2591_probe
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册