Skip to content

Commit 5865918

Browse files
pcercueirafaeljw
authored andcommitted
iio: pressure: bmp280: Use new PM macros
Use the new EXPORT_RUNTIME_DEV_PM_OPS() macro. It allows the underlying dev_pm_ops struct as well as the suspend/resume callbacks to be detected as dead code in the case where CONFIG_PM is disabled, without having to wrap everything inside #ifdef CONFIG_PM guards. Signed-off-by: Paul Cercueil <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent d59ff7d commit 5865918

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

drivers/iio/pressure/bmp280-core.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,6 @@ int bmp280_common_probe(struct device *dev,
11381138
}
11391139
EXPORT_SYMBOL(bmp280_common_probe);
11401140

1141-
#ifdef CONFIG_PM
11421141
static int bmp280_runtime_suspend(struct device *dev)
11431142
{
11441143
struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -1159,15 +1158,9 @@ static int bmp280_runtime_resume(struct device *dev)
11591158
usleep_range(data->start_up_time, data->start_up_time + 100);
11601159
return data->chip_info->chip_config(data);
11611160
}
1162-
#endif /* CONFIG_PM */
11631161

1164-
const struct dev_pm_ops bmp280_dev_pm_ops = {
1165-
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
1166-
pm_runtime_force_resume)
1167-
SET_RUNTIME_PM_OPS(bmp280_runtime_suspend,
1168-
bmp280_runtime_resume, NULL)
1169-
};
1170-
EXPORT_SYMBOL(bmp280_dev_pm_ops);
1162+
EXPORT_RUNTIME_DEV_PM_OPS(bmp280_dev_pm_ops, bmp280_runtime_suspend,
1163+
bmp280_runtime_resume, NULL);
11711164

11721165
MODULE_AUTHOR("Vlad Dogaru <[email protected]>");
11731166
MODULE_DESCRIPTION("Driver for Bosch Sensortec BMP180/BMP280 pressure and temperature sensor");

drivers/iio/pressure/bmp280-i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static struct i2c_driver bmp280_i2c_driver = {
5858
.driver = {
5959
.name = "bmp280",
6060
.of_match_table = bmp280_of_i2c_match,
61-
.pm = &bmp280_dev_pm_ops,
61+
.pm = pm_ptr(&bmp280_dev_pm_ops),
6262
},
6363
.probe = bmp280_i2c_probe,
6464
.id_table = bmp280_i2c_id,

drivers/iio/pressure/bmp280-spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static struct spi_driver bmp280_spi_driver = {
109109
.driver = {
110110
.name = "bmp280",
111111
.of_match_table = bmp280_of_spi_match,
112-
.pm = &bmp280_dev_pm_ops,
112+
.pm = pm_ptr(&bmp280_dev_pm_ops),
113113
},
114114
.id_table = bmp280_spi_id,
115115
.probe = bmp280_spi_probe,

0 commit comments

Comments
 (0)