Skip to content

Commit 95d5a72

Browse files
jic23rafaeljw
authored andcommitted
iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume()
Whilst here move to the new infrastructure using pm_sleep_ptr() and EXPORT_DEV_PM_OPS() so as to let the compiler remove the unused code if CONFIG_SLEEP is not defined. Signed-off-by: Jonathan Cameron <[email protected]> Cc: Tomasz Duszynski <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 3123109 commit 95d5a72

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

drivers/iio/chemical/scd30.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ struct scd30_state {
6868
scd30_command_t command;
6969
};
7070

71-
int scd30_suspend(struct device *dev);
72-
int scd30_resume(struct device *dev);
73-
74-
static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
71+
extern const struct dev_pm_ops scd30_pm_ops;
7572

7673
int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command);
7774

drivers/iio/chemical/scd30_core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
517517
IIO_CHAN_SOFT_TIMESTAMP(3),
518518
};
519519

520-
int __maybe_unused scd30_suspend(struct device *dev)
520+
static int scd30_suspend(struct device *dev)
521521
{
522522
struct iio_dev *indio_dev = dev_get_drvdata(dev);
523523
struct scd30_state *state = iio_priv(indio_dev);
@@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)
529529

530530
return regulator_disable(state->vdd);
531531
}
532-
EXPORT_SYMBOL(scd30_suspend);
533532

534-
int __maybe_unused scd30_resume(struct device *dev)
533+
static int scd30_resume(struct device *dev)
535534
{
536535
struct iio_dev *indio_dev = dev_get_drvdata(dev);
537536
struct scd30_state *state = iio_priv(indio_dev);
@@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)
543542

544543
return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
545544
}
546-
EXPORT_SYMBOL(scd30_resume);
545+
546+
EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
547547

548548
static void scd30_stop_meas(void *data)
549549
{

drivers/iio/chemical/scd30_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
128128
.driver = {
129129
.name = KBUILD_MODNAME,
130130
.of_match_table = scd30_i2c_of_match,
131-
.pm = &scd30_pm_ops,
131+
.pm = pm_sleep_ptr(&scd30_pm_ops),
132132
},
133133
.probe_new = scd30_i2c_probe,
134134
};

drivers/iio/chemical/scd30_serial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
252252
.driver = {
253253
.name = KBUILD_MODNAME,
254254
.of_match_table = scd30_serdev_of_match,
255-
.pm = &scd30_pm_ops,
255+
.pm = pm_sleep_ptr(&scd30_pm_ops),
256256
},
257257
.probe = scd30_serdev_probe,
258258
};

0 commit comments

Comments
 (0)