diff mbox series

[27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()

Message ID 20220621202719.13644-28-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series IIO: switch easy cases to new simpler PM related macros. | expand

Commit Message

Jonathan Cameron June 21, 2022, 8:27 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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@huawei.com>
Cc: Cai Huoqing <cai.huoqing@linux.dev>
---
 drivers/iio/adc/imx8qxp-adc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Bough Chen June 22, 2022, 9:32 a.m. UTC | #1
> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: 2022年6月22日 4:27
> To: linux-iio@vger.kernel.org; Paul Cercueil <paul@crapouillou.net>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>; Brian Masney
> <masneyb@onstation.org>; David Heidelberg <david@ixit.cz>; Cai Huoqing
> <cai.huoqing@linux.dev>; Christian Eggers <ceggers@arri.de>; Enric Balletbo i
> Serra <enric.balletbo@collabora.com>; Eugen Hristev
> <eugen.hristev@microchip.com>; Gwendal Grignou <gwendal@chromium.org>;
> Bough Chen <haibo.chen@nxp.com>; Hui Liu <hui.liu@mediatek.com>; Joe
> Sandom <joe.g.sandom@gmail.com>; Ismail H . Kose <ihkose@gmail.com>;
> Lars-Peter Clausen <lars@metafoo.de>; Linus Walleij <linus.walleij@linaro.org>;
> Ludovic Desroches <ludovic.desroches@microchip.com>; Nicolas Ferre
> <nicolas.ferre@microchip.com>; Marcus Folkesson
> <marcus.folkesson@gmail.com>; Martin Blumenstingl
> <martin.blumenstingl@googlemail.com>; Mathieu Othacehe
> <m.othacehe@gmail.com>; Michal Simek <michal.simek@xilinx.com>; Miquel
> Raynal <miquel.raynal@bootlin.com>; Nuno Sá <nuno.sa@analog.com>;
> Parthiban Nallathambi <pn@denx.de>; Philippe Reynes <tremyfr@yahoo.fr>;
> Philippe Schenker <philippe.schenker@toradex.com>; Rishi Gupta
> <gupt21@gmail.com>; Roan van Dijk <roan@protonic.nl>; Stephen Boyd
> <swboyd@chromium.org>; Tomasz Duszynski <tduszyns@gmail.com>; Zhiyong
> Tao <zhiyong.tao@mediatek.com>; Jonathan Cameron
> <Jonathan.Cameron@huawei.com>
> Subject: [PATCH 27/36] iio: adc: imx8qxp: Switch to
> DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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@huawei.com>
> Cc: Cai Huoqing <cai.huoqing@linux.dev>

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>

> ---
>  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
diff mbox series

Patch

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),
 	},
 };