Message ID | 20220807192038.1039771-3-jic23@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | PM: Introduce EXPORT_NS_GPL_DEV_PM_OPS() and use cases in IIO. | expand |
On Sun, Aug 07, 2022 at 08:20:35PM +0100, Jonathan Cameron wrote: > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > 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: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Cc: Sean Nyekjaer <sean@geanix.com> Acked-by: Sean Nyekjaer <sean@geanix.com> /Sean > --- > drivers/iio/accel/fxls8962af-core.c | 17 +++++++---------- > drivers/iio/accel/fxls8962af-i2c.c | 2 +- > drivers/iio/accel/fxls8962af-spi.c | 2 +- > 3 files changed, 9 insertions(+), 12 deletions(-) > > diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c > index 8874d6d61725..6c7dde4a1af9 100644 > --- a/drivers/iio/accel/fxls8962af-core.c > +++ b/drivers/iio/accel/fxls8962af-core.c > @@ -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); > > -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)); > int ret; > @@ -1255,14 +1255,14 @@ static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev) > 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)); > > 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 fxls8962af_data *data = iio_priv(indio_dev); > @@ -1283,7 +1283,7 @@ static int __maybe_unused fxls8962af_suspend(struct device *dev) > 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 fxls8962af_data *data = iio_priv(indio_dev); > @@ -1300,12 +1300,9 @@ static int __maybe_unused fxls8962af_resume(struct device *dev) > return 0; > } > > -const struct dev_pm_ops fxls8962af_pm_ops = { > - SET_SYSTEM_SLEEP_PM_OPS(fxls8962af_suspend, fxls8962af_resume) > - SET_RUNTIME_PM_OPS(fxls8962af_runtime_suspend, > - fxls8962af_runtime_resume, NULL) > -}; > -EXPORT_SYMBOL_NS_GPL(fxls8962af_pm_ops, IIO_FXLS8962AF); > +EXPORT_NS_GPL_DEV_PM_OPS(fxls8962af_pm_ops, fxls8962af_suspend, fxls8962af_resume, > + fxls8962af_runtime_suspend, fxls8962af_runtime_resume, NULL, > + IIO_FXLS8962AF); > > MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>"); > MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer driver"); > diff --git a/drivers/iio/accel/fxls8962af-i2c.c b/drivers/iio/accel/fxls8962af-i2c.c > index 8fbadfea1620..22640eaebac7 100644 > --- a/drivers/iio/accel/fxls8962af-i2c.c > +++ b/drivers/iio/accel/fxls8962af-i2c.c > @@ -45,7 +45,7 @@ static struct i2c_driver fxls8962af_driver = { > .driver = { > .name = "fxls8962af_i2c", > .of_match_table = fxls8962af_of_match, > - .pm = &fxls8962af_pm_ops, > + .pm = pm_ptr(&fxls8962af_pm_ops), > }, > .probe_new = fxls8962af_probe, > .id_table = fxls8962af_id, > diff --git a/drivers/iio/accel/fxls8962af-spi.c b/drivers/iio/accel/fxls8962af-spi.c > index 885b3ab7fcb5..a0d192211839 100644 > --- a/drivers/iio/accel/fxls8962af-spi.c > +++ b/drivers/iio/accel/fxls8962af-spi.c > @@ -44,7 +44,7 @@ MODULE_DEVICE_TABLE(spi, fxls8962af_spi_id_table); > static struct spi_driver fxls8962af_driver = { > .driver = { > .name = "fxls8962af_spi", > - .pm = &fxls8962af_pm_ops, > + .pm = pm_ptr(&fxls8962af_pm_ops), > .of_match_table = fxls8962af_spi_of_match, > }, > .probe = fxls8962af_probe, > -- > 2.37.1 >
diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c index 8874d6d61725..6c7dde4a1af9 100644 --- a/drivers/iio/accel/fxls8962af-core.c +++ b/drivers/iio/accel/fxls8962af-core.c @@ -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); -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)); int ret; @@ -1255,14 +1255,14 @@ static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev) 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)); 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 fxls8962af_data *data = iio_priv(indio_dev); @@ -1283,7 +1283,7 @@ static int __maybe_unused fxls8962af_suspend(struct device *dev) 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 fxls8962af_data *data = iio_priv(indio_dev); @@ -1300,12 +1300,9 @@ static int __maybe_unused fxls8962af_resume(struct device *dev) return 0; } -const struct dev_pm_ops fxls8962af_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(fxls8962af_suspend, fxls8962af_resume) - SET_RUNTIME_PM_OPS(fxls8962af_runtime_suspend, - fxls8962af_runtime_resume, NULL) -}; -EXPORT_SYMBOL_NS_GPL(fxls8962af_pm_ops, IIO_FXLS8962AF); +EXPORT_NS_GPL_DEV_PM_OPS(fxls8962af_pm_ops, fxls8962af_suspend, fxls8962af_resume, + fxls8962af_runtime_suspend, fxls8962af_runtime_resume, NULL, + IIO_FXLS8962AF); MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>"); MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer driver"); diff --git a/drivers/iio/accel/fxls8962af-i2c.c b/drivers/iio/accel/fxls8962af-i2c.c index 8fbadfea1620..22640eaebac7 100644 --- a/drivers/iio/accel/fxls8962af-i2c.c +++ b/drivers/iio/accel/fxls8962af-i2c.c @@ -45,7 +45,7 @@ static struct i2c_driver fxls8962af_driver = { .driver = { .name = "fxls8962af_i2c", .of_match_table = fxls8962af_of_match, - .pm = &fxls8962af_pm_ops, + .pm = pm_ptr(&fxls8962af_pm_ops), }, .probe_new = fxls8962af_probe, .id_table = fxls8962af_id, diff --git a/drivers/iio/accel/fxls8962af-spi.c b/drivers/iio/accel/fxls8962af-spi.c index 885b3ab7fcb5..a0d192211839 100644 --- a/drivers/iio/accel/fxls8962af-spi.c +++ b/drivers/iio/accel/fxls8962af-spi.c @@ -44,7 +44,7 @@ MODULE_DEVICE_TABLE(spi, fxls8962af_spi_id_table); static struct spi_driver fxls8962af_driver = { .driver = { .name = "fxls8962af_spi", - .pm = &fxls8962af_pm_ops, + .pm = pm_ptr(&fxls8962af_pm_ops), .of_match_table = fxls8962af_spi_of_match, }, .probe = fxls8962af_probe,