Commit 95d5a721 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Rafael J. Wysocki
Browse files

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: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 31231092
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -68,10 +68,7 @@ struct scd30_state {
	scd30_command_t command;
	scd30_command_t command;
};
};


int scd30_suspend(struct device *dev);
extern const struct dev_pm_ops scd30_pm_ops;
int scd30_resume(struct device *dev);

static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);


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


+4 −4
Original line number Original line Diff line number Diff line
@@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
	IIO_CHAN_SOFT_TIMESTAMP(3),
	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 iio_dev *indio_dev = dev_get_drvdata(dev);
	struct scd30_state *state  = iio_priv(indio_dev);
	struct scd30_state *state  = iio_priv(indio_dev);
@@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)


	return regulator_disable(state->vdd);
	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 iio_dev *indio_dev = dev_get_drvdata(dev);
	struct scd30_state *state = iio_priv(indio_dev);
	struct scd30_state *state = iio_priv(indio_dev);
@@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)


	return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
	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)
static void scd30_stop_meas(void *data)
{
{
+1 −1
Original line number Original line Diff line number Diff line
@@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
	.driver = {
	.driver = {
		.name = KBUILD_MODNAME,
		.name = KBUILD_MODNAME,
		.of_match_table = scd30_i2c_of_match,
		.of_match_table = scd30_i2c_of_match,
		.pm = &scd30_pm_ops,
		.pm = pm_sleep_ptr(&scd30_pm_ops),
	},
	},
	.probe_new = scd30_i2c_probe,
	.probe_new = scd30_i2c_probe,
};
};
+1 −1
Original line number Original line Diff line number Diff line
@@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
	.driver = {
	.driver = {
		.name = KBUILD_MODNAME,
		.name = KBUILD_MODNAME,
		.of_match_table = scd30_serdev_of_match,
		.of_match_table = scd30_serdev_of_match,
		.pm = &scd30_pm_ops,
		.pm = pm_sleep_ptr(&scd30_pm_ops),
	},
	},
	.probe = scd30_serdev_probe,
	.probe = scd30_serdev_probe,
};
};