> -----Original Message----- > From: Jonathan Cameron <jic23@xxxxxxxxxx> > Sent: 2022年6月22日 4:27 > To: linux-iio@xxxxxxxxxxxxxxx; Paul Cercueil <paul@xxxxxxxxxxxxxxx> > Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>; Brian Masney > <masneyb@xxxxxxxxxxxxx>; David Heidelberg <david@xxxxxxx>; Cai Huoqing > <cai.huoqing@xxxxxxxxx>; Christian Eggers <ceggers@xxxxxxx>; Enric Balletbo i > Serra <enric.balletbo@xxxxxxxxxxxxx>; Eugen Hristev > <eugen.hristev@xxxxxxxxxxxxx>; Gwendal Grignou <gwendal@xxxxxxxxxxxx>; > Bough Chen <haibo.chen@xxxxxxx>; Hui Liu <hui.liu@xxxxxxxxxxxx>; Joe > Sandom <joe.g.sandom@xxxxxxxxx>; Ismail H . Kose <ihkose@xxxxxxxxx>; > Lars-Peter Clausen <lars@xxxxxxxxxx>; Linus Walleij <linus.walleij@xxxxxxxxxx>; > Ludovic Desroches <ludovic.desroches@xxxxxxxxxxxxx>; Nicolas Ferre > <nicolas.ferre@xxxxxxxxxxxxx>; Marcus Folkesson > <marcus.folkesson@xxxxxxxxx>; Martin Blumenstingl > <martin.blumenstingl@xxxxxxxxxxxxxx>; Mathieu Othacehe > <m.othacehe@xxxxxxxxx>; Michal Simek <michal.simek@xxxxxxxxxx>; Miquel > Raynal <miquel.raynal@xxxxxxxxxxx>; Nuno Sá <nuno.sa@xxxxxxxxxx>; > Parthiban Nallathambi <pn@xxxxxxx>; Philippe Reynes <tremyfr@xxxxxxxx>; > Philippe Schenker <philippe.schenker@xxxxxxxxxxx>; Rishi Gupta > <gupt21@xxxxxxxxx>; Roan van Dijk <roan@xxxxxxxxxxx>; Stephen Boyd > <swboyd@xxxxxxxxxxxx>; Tomasz Duszynski <tduszyns@xxxxxxxxx>; Zhiyong > Tao <zhiyong.tao@xxxxxxxxxxxx>; Jonathan Cameron > <Jonathan.Cameron@xxxxxxxxxx> > Subject: [PATCH 27/36] iio: adc: imx8qxp: Switch to > DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() > > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > Switching to these newer macros allows the compiler to remove the unused > functions and struct dev_pm_ops if !CONFIG_PM without the need to mark > anything __maybe_unused. > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Cc: Cai Huoqing <cai.huoqing@xxxxxxxxx> Reviewed-by: Haibo Chen <haibo.chen@xxxxxxx> > --- > drivers/iio/adc/imx8qxp-adc.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c index > e8c9a69e10eb..e48446784a0a 100644 > --- a/drivers/iio/adc/imx8qxp-adc.c > +++ b/drivers/iio/adc/imx8qxp-adc.c > @@ -417,7 +417,7 @@ static int imx8qxp_adc_remove(struct platform_device > *pdev) > return 0; > } > > -static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev) > +static int imx8qxp_adc_runtime_suspend(struct device *dev) > { > struct iio_dev *indio_dev = dev_get_drvdata(dev); > struct imx8qxp_adc *adc = iio_priv(indio_dev); @@ -431,7 +431,7 @@ > static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev) > return 0; > } > > -static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev) > +static int imx8qxp_adc_runtime_resume(struct device *dev) > { > struct iio_dev *indio_dev = dev_get_drvdata(dev); > struct imx8qxp_adc *adc = iio_priv(indio_dev); @@ -468,10 +468,9 @@ > static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev) > return ret; > } > > -static const struct dev_pm_ops imx8qxp_adc_pm_ops = { > - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, > pm_runtime_force_resume) > - SET_RUNTIME_PM_OPS(imx8qxp_adc_runtime_suspend, > imx8qxp_adc_runtime_resume, NULL) > -}; > +static DEFINE_RUNTIME_DEV_PM_OPS(imx8qxp_adc_pm_ops, > + imx8qxp_adc_runtime_suspend, > + imx8qxp_adc_runtime_resume, NULL); > > static const struct of_device_id imx8qxp_adc_match[] = { > { .compatible = "nxp,imx8qxp-adc", }, > @@ -485,7 +484,7 @@ static struct platform_driver imx8qxp_adc_driver = { > .driver = { > .name = ADC_DRIVER_NAME, > .of_match_table = imx8qxp_adc_match, > - .pm = &imx8qxp_adc_pm_ops, > + .pm = pm_ptr(&imx8qxp_adc_pm_ops), > }, > }; > > -- > 2.36.1