Commit 687c8848 authored by Jonathan Cameron's avatar Jonathan Cameron

iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS()

Using this macro allows the compiler to remove unused
structures and callbacks if we are not building with
CONFIG_PM* without needing __maybe_unused markings.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Sean Nyekjaer <sean@geanix.com>

--
Switched to Paul Cercueil's more flexible implementation fo the macro.
Dropped Sean's Ack given new form of macro being used.
Acked-by: default avatarSean Nyekjaer <sean@geanix.com>
Link: https://lore.kernel.org/r/20220925155719.3316280-3-jic23@kernel.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 0c3a3335
...@@ -1241,7 +1241,7 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq) ...@@ -1241,7 +1241,7 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq)
} }
EXPORT_SYMBOL_NS_GPL(fxls8962af_core_probe, IIO_FXLS8962AF); EXPORT_SYMBOL_NS_GPL(fxls8962af_core_probe, IIO_FXLS8962AF);
static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev) static int fxls8962af_runtime_suspend(struct device *dev)
{ {
struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev)); struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev));
int ret; int ret;
...@@ -1255,14 +1255,14 @@ static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev) ...@@ -1255,14 +1255,14 @@ static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev)
return 0; return 0;
} }
static int __maybe_unused fxls8962af_runtime_resume(struct device *dev) static int fxls8962af_runtime_resume(struct device *dev)
{ {
struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev)); struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev));
return fxls8962af_active(data); return fxls8962af_active(data);
} }
static int __maybe_unused fxls8962af_suspend(struct device *dev) static int fxls8962af_suspend(struct device *dev)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct fxls8962af_data *data = iio_priv(indio_dev); struct fxls8962af_data *data = iio_priv(indio_dev);
...@@ -1283,7 +1283,7 @@ static int __maybe_unused fxls8962af_suspend(struct device *dev) ...@@ -1283,7 +1283,7 @@ static int __maybe_unused fxls8962af_suspend(struct device *dev)
return 0; return 0;
} }
static int __maybe_unused fxls8962af_resume(struct device *dev) static int fxls8962af_resume(struct device *dev)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct fxls8962af_data *data = iio_priv(indio_dev); struct fxls8962af_data *data = iio_priv(indio_dev);
...@@ -1300,12 +1300,10 @@ static int __maybe_unused fxls8962af_resume(struct device *dev) ...@@ -1300,12 +1300,10 @@ static int __maybe_unused fxls8962af_resume(struct device *dev)
return 0; return 0;
} }
const struct dev_pm_ops fxls8962af_pm_ops = { EXPORT_NS_GPL_DEV_PM_OPS(fxls8962af_pm_ops, IIO_FXLS8962AF) = {
SET_SYSTEM_SLEEP_PM_OPS(fxls8962af_suspend, fxls8962af_resume) SYSTEM_SLEEP_PM_OPS(fxls8962af_suspend, fxls8962af_resume)
SET_RUNTIME_PM_OPS(fxls8962af_runtime_suspend, RUNTIME_PM_OPS(fxls8962af_runtime_suspend, fxls8962af_runtime_resume, NULL)
fxls8962af_runtime_resume, NULL)
}; };
EXPORT_SYMBOL_NS_GPL(fxls8962af_pm_ops, IIO_FXLS8962AF);
MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>"); MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>");
MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer driver"); MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer driver");
......
...@@ -45,7 +45,7 @@ static struct i2c_driver fxls8962af_driver = { ...@@ -45,7 +45,7 @@ static struct i2c_driver fxls8962af_driver = {
.driver = { .driver = {
.name = "fxls8962af_i2c", .name = "fxls8962af_i2c",
.of_match_table = fxls8962af_of_match, .of_match_table = fxls8962af_of_match,
.pm = &fxls8962af_pm_ops, .pm = pm_ptr(&fxls8962af_pm_ops),
}, },
.probe_new = fxls8962af_probe, .probe_new = fxls8962af_probe,
.id_table = fxls8962af_id, .id_table = fxls8962af_id,
......
...@@ -44,7 +44,7 @@ MODULE_DEVICE_TABLE(spi, fxls8962af_spi_id_table); ...@@ -44,7 +44,7 @@ MODULE_DEVICE_TABLE(spi, fxls8962af_spi_id_table);
static struct spi_driver fxls8962af_driver = { static struct spi_driver fxls8962af_driver = {
.driver = { .driver = {
.name = "fxls8962af_spi", .name = "fxls8962af_spi",
.pm = &fxls8962af_pm_ops, .pm = pm_ptr(&fxls8962af_pm_ops),
.of_match_table = fxls8962af_spi_of_match, .of_match_table = fxls8962af_spi_of_match,
}, },
.probe = fxls8962af_probe, .probe = fxls8962af_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