Commit 2129f25d authored by Jonathan Cameron's avatar Jonathan Cameron

iio: humidity: hts221: Use EXPORT_SIMPLE_DEV_PM_OPS() to allow compiler to remove dead code.

If CONFIG_PM_SLEEP is not defined using EXPORT_SIMPLE_DEV_PM_OPS()
in conjunction with pm_sleep_ptr() allows the compiler to remove
the unused code and data. This removes the need for __maybe_unused
markings etc.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/20220220181522.541718-6-jic23@kernel.orgAcked-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/20220604161223.461847-3-jic23@kernel.org
parent cb490b10
...@@ -670,7 +670,7 @@ int hts221_probe(struct device *dev, int irq, const char *name, ...@@ -670,7 +670,7 @@ int hts221_probe(struct device *dev, int irq, const char *name,
} }
EXPORT_SYMBOL(hts221_probe); EXPORT_SYMBOL(hts221_probe);
static int __maybe_unused hts221_suspend(struct device *dev) static int hts221_suspend(struct device *dev)
{ {
struct iio_dev *iio_dev = dev_get_drvdata(dev); struct iio_dev *iio_dev = dev_get_drvdata(dev);
struct hts221_hw *hw = iio_priv(iio_dev); struct hts221_hw *hw = iio_priv(iio_dev);
...@@ -680,7 +680,7 @@ static int __maybe_unused hts221_suspend(struct device *dev) ...@@ -680,7 +680,7 @@ static int __maybe_unused hts221_suspend(struct device *dev)
FIELD_PREP(HTS221_ENABLE_MASK, false)); FIELD_PREP(HTS221_ENABLE_MASK, false));
} }
static int __maybe_unused hts221_resume(struct device *dev) static int hts221_resume(struct device *dev)
{ {
struct iio_dev *iio_dev = dev_get_drvdata(dev); struct iio_dev *iio_dev = dev_get_drvdata(dev);
struct hts221_hw *hw = iio_priv(iio_dev); struct hts221_hw *hw = iio_priv(iio_dev);
...@@ -694,10 +694,7 @@ static int __maybe_unused hts221_resume(struct device *dev) ...@@ -694,10 +694,7 @@ static int __maybe_unused hts221_resume(struct device *dev)
return err; return err;
} }
const struct dev_pm_ops hts221_pm_ops = { EXPORT_SIMPLE_DEV_PM_OPS(hts221_pm_ops, hts221_suspend, hts221_resume);
SET_SYSTEM_SLEEP_PM_OPS(hts221_suspend, hts221_resume)
};
EXPORT_SYMBOL(hts221_pm_ops);
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>"); MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>");
MODULE_DESCRIPTION("STMicroelectronics hts221 sensor driver"); MODULE_DESCRIPTION("STMicroelectronics hts221 sensor driver");
......
...@@ -62,7 +62,7 @@ MODULE_DEVICE_TABLE(i2c, hts221_i2c_id_table); ...@@ -62,7 +62,7 @@ MODULE_DEVICE_TABLE(i2c, hts221_i2c_id_table);
static struct i2c_driver hts221_driver = { static struct i2c_driver hts221_driver = {
.driver = { .driver = {
.name = "hts221_i2c", .name = "hts221_i2c",
.pm = &hts221_pm_ops, .pm = pm_sleep_ptr(&hts221_pm_ops),
.of_match_table = hts221_i2c_of_match, .of_match_table = hts221_i2c_of_match,
.acpi_match_table = ACPI_PTR(hts221_acpi_match), .acpi_match_table = ACPI_PTR(hts221_acpi_match),
}, },
......
...@@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(spi, hts221_spi_id_table); ...@@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(spi, hts221_spi_id_table);
static struct spi_driver hts221_driver = { static struct spi_driver hts221_driver = {
.driver = { .driver = {
.name = "hts221_spi", .name = "hts221_spi",
.pm = &hts221_pm_ops, .pm = pm_sleep_ptr(&hts221_pm_ops),
.of_match_table = hts221_spi_of_match, .of_match_table = hts221_spi_of_match,
}, },
.probe = hts221_spi_probe, .probe = hts221_spi_probe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment