diff mbox series

[04/36] iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Message ID 20220621202719.13644-5-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:26 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

In this case we only gain the ability to have the compiler drop the
struct dev_pm_ops because the callbacks are called from paths other
than suspend and resume.  In general the purpose of this new macro
is to allow automated removal of the callbacks as well, but that doesn't
apply here.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/iio/adc/imx7d_adc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Bough Chen June 22, 2022, 9:31 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 04/36] iio: adc: imx7d_adc: Switch to
> DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> In this case we only gain the ability to have the compiler drop the struct
> dev_pm_ops because the callbacks are called from paths other than suspend
> and resume.  In general the purpose of this new macro is to allow automated
> removal of the callbacks as well, but that doesn't apply here.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Haibo Chen <haibo.chen@nxp.com>

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

> ---
>  drivers/iio/adc/imx7d_adc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c index
> 119217af2bde..86caff1d006b 100644
> --- a/drivers/iio/adc/imx7d_adc.c
> +++ b/drivers/iio/adc/imx7d_adc.c
> @@ -540,14 +540,15 @@ static int imx7d_adc_probe(struct platform_device
> *pdev)
>  	return 0;
>  }
> 
> -static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable,
> imx7d_adc_enable);
> +static DEFINE_SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops,
> imx7d_adc_disable,
> +				imx7d_adc_enable);
> 
>  static struct platform_driver imx7d_adc_driver = {
>  	.probe		= imx7d_adc_probe,
>  	.driver		= {
>  		.name	= "imx7d_adc",
>  		.of_match_table = imx7d_adc_match,
> -		.pm	= &imx7d_adc_pm_ops,
> +		.pm	= pm_sleep_ptr(&imx7d_adc_pm_ops),
>  	},
>  };
> 
> --
> 2.36.1
diff mbox series

Patch

diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 119217af2bde..86caff1d006b 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -540,14 +540,15 @@  static int imx7d_adc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable, imx7d_adc_enable);
+static DEFINE_SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable,
+				imx7d_adc_enable);
 
 static struct platform_driver imx7d_adc_driver = {
 	.probe		= imx7d_adc_probe,
 	.driver		= {
 		.name	= "imx7d_adc",
 		.of_match_table = imx7d_adc_match,
-		.pm	= &imx7d_adc_pm_ops,
+		.pm	= pm_sleep_ptr(&imx7d_adc_pm_ops),
 	},
 };