Skip to content

Commit

Permalink
iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resu…
Browse files Browse the repository at this point in the history
…me()

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 <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Jonathan Cameron authored and Rafael J. Wysocki committed Apr 5, 2022
1 parent 3123109 commit 95d5a72
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
5 changes: 1 addition & 4 deletions drivers/iio/chemical/scd30.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ struct scd30_state {
scd30_command_t command;
};

int scd30_suspend(struct device *dev);
int scd30_resume(struct device *dev);

static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
extern const struct dev_pm_ops scd30_pm_ops;

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

Expand Down
8 changes: 4 additions & 4 deletions drivers/iio/chemical/scd30_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(3),
};

int __maybe_unused scd30_suspend(struct device *dev)
static int scd30_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct scd30_state *state = iio_priv(indio_dev);
Expand All @@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)

return regulator_disable(state->vdd);
}
EXPORT_SYMBOL(scd30_suspend);

int __maybe_unused scd30_resume(struct device *dev)
static int scd30_resume(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct scd30_state *state = iio_priv(indio_dev);
Expand All @@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)

return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
}
EXPORT_SYMBOL(scd30_resume);

EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);

static void scd30_stop_meas(void *data)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/chemical/scd30_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = scd30_i2c_of_match,
.pm = &scd30_pm_ops,
.pm = pm_sleep_ptr(&scd30_pm_ops),
},
.probe_new = scd30_i2c_probe,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/chemical/scd30_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = scd30_serdev_of_match,
.pm = &scd30_pm_ops,
.pm = pm_sleep_ptr(&scd30_pm_ops),
},
.probe = scd30_serdev_probe,
};
Expand Down

0 comments on commit 95d5a72

Please sign in to comment.