iio: imu: lsm6dsx: Use new pm_sleep_ptr() and EXPORT_SIMPLE_DEV_PM_OPS()

These new functions move the burden of removing unused code when
CONFIG_PM_SLEEP is not defined onto the compiler rather than requiring
the use of CONFIG_PM guards and similar.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220220181522.541718-8-jic23@kernel.org
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/20220604161223.461847-5-jic23@kernel.org
This commit is contained in:
Jonathan Cameron 2022-06-04 17:12:22 +01:00
parent 1300ab3927
commit acc416ff7d
4 changed files with 7 additions and 9 deletions

View File

@ -2291,7 +2291,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
} }
EXPORT_SYMBOL(st_lsm6dsx_probe); EXPORT_SYMBOL(st_lsm6dsx_probe);
static int __maybe_unused st_lsm6dsx_suspend(struct device *dev) static int st_lsm6dsx_suspend(struct device *dev)
{ {
struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev); struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev);
struct st_lsm6dsx_sensor *sensor; struct st_lsm6dsx_sensor *sensor;
@ -2330,7 +2330,7 @@ static int __maybe_unused st_lsm6dsx_suspend(struct device *dev)
return err; return err;
} }
static int __maybe_unused st_lsm6dsx_resume(struct device *dev) static int st_lsm6dsx_resume(struct device *dev)
{ {
struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev); struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev);
struct st_lsm6dsx_sensor *sensor; struct st_lsm6dsx_sensor *sensor;
@ -2366,10 +2366,8 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev)
return err; return err;
} }
const struct dev_pm_ops st_lsm6dsx_pm_ops = { EXPORT_SIMPLE_DEV_PM_OPS(st_lsm6dsx_pm_ops, st_lsm6dsx_suspend,
SET_SYSTEM_SLEEP_PM_OPS(st_lsm6dsx_suspend, st_lsm6dsx_resume) st_lsm6dsx_resume);
};
EXPORT_SYMBOL(st_lsm6dsx_pm_ops);
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>"); MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>");
MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>"); MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");

View File

@ -134,7 +134,7 @@ MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
static struct i2c_driver st_lsm6dsx_driver = { static struct i2c_driver st_lsm6dsx_driver = {
.driver = { .driver = {
.name = "st_lsm6dsx_i2c", .name = "st_lsm6dsx_i2c",
.pm = &st_lsm6dsx_pm_ops, .pm = pm_sleep_ptr(&st_lsm6dsx_pm_ops),
.of_match_table = st_lsm6dsx_i2c_of_match, .of_match_table = st_lsm6dsx_i2c_of_match,
}, },
.probe = st_lsm6dsx_i2c_probe, .probe = st_lsm6dsx_i2c_probe,

View File

@ -44,7 +44,7 @@ static int st_lsm6dsx_i3c_probe(struct i3c_device *i3cdev)
static struct i3c_driver st_lsm6dsx_driver = { static struct i3c_driver st_lsm6dsx_driver = {
.driver = { .driver = {
.name = "st_lsm6dsx_i3c", .name = "st_lsm6dsx_i3c",
.pm = &st_lsm6dsx_pm_ops, .pm = pm_sleep_ptr(&st_lsm6dsx_pm_ops),
}, },
.probe = st_lsm6dsx_i3c_probe, .probe = st_lsm6dsx_i3c_probe,
.id_table = st_lsm6dsx_i3c_ids, .id_table = st_lsm6dsx_i3c_ids,

View File

@ -134,7 +134,7 @@ MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
static struct spi_driver st_lsm6dsx_driver = { static struct spi_driver st_lsm6dsx_driver = {
.driver = { .driver = {
.name = "st_lsm6dsx_spi", .name = "st_lsm6dsx_spi",
.pm = &st_lsm6dsx_pm_ops, .pm = pm_sleep_ptr(&st_lsm6dsx_pm_ops),
.of_match_table = st_lsm6dsx_spi_of_match, .of_match_table = st_lsm6dsx_spi_of_match,
}, },
.probe = st_lsm6dsx_spi_probe, .probe = st_lsm6dsx_spi_probe,