All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <nuno.sa@analog.com>
To: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
Cc: jic23@kernel.org, linux-iio@vger.kernel.org,
	Michael.Hennerich@analog.com, dlechner@baylibre.com,
	andy@kernel.org, linux@analog.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: ad7606: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Date: Fri, 16 Oct 2026 10:25:29 +0100	[thread overview]
Message-ID: <atHtenc-1IRYSRGU@nsa> (raw)
In-Reply-To: <20261015151903.13613-1-abdelnasserhussein11@gmail.com>

On Thu, Oct 15, 2026 at 06:19:03PM +0300, Abdelnasser Hussein wrote:
> Replace SIMPLE_DEV_PM_OPS() with EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS()
> and use pm_sleep_ptr() to wire up the power management operations.
> 
> This allows dropping the #ifdef CONFIG_PM_SLEEP guards, simplifying the
> code and improving compile test coverage of the suspend/resume callbacks
> while still allowing the compiler to optimize them out when
> CONFIG_PM_SLEEP is disabled.
> 
> Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/adc/ad7606.c     | 9 +++------
>  drivers/iio/adc/ad7606.h     | 5 -----
>  drivers/iio/adc/ad7606_par.c | 3 ++-
>  drivers/iio/adc/ad7606_spi.c | 3 ++-
>  4 files changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index cebb8ed8dcb1..e71ff8d38e4c 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -14,6 +14,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
> +#include <linux/pm.h>
>  #include <linux/property.h>
>  #include <linux/pwm.h>
>  #include <linux/regulator/consumer.h>
> @@ -1673,8 +1674,6 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
>  }
>  EXPORT_SYMBOL_NS_GPL(ad7606_probe, "IIO_AD7606");
>  
> -#ifdef CONFIG_PM_SLEEP
> -
>  static int ad7606_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> @@ -1702,10 +1701,8 @@ static int ad7606_resume(struct device *dev)
>  	return 0;
>  }
>  
> -SIMPLE_DEV_PM_OPS(ad7606_pm_ops, ad7606_suspend, ad7606_resume);
> -EXPORT_SYMBOL_NS_GPL(ad7606_pm_ops, "IIO_AD7606");
> -
> -#endif
> +EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(ad7606_pm_ops, ad7606_suspend, ad7606_resume,
> +				IIO_AD7606);
>  
>  MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
>  MODULE_DESCRIPTION("Analog Devices AD7606 ADC");
> diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h
> index 2951bb731354..c60f71a38883 100644
> --- a/drivers/iio/adc/ad7606.h
> +++ b/drivers/iio/adc/ad7606.h
> @@ -241,11 +241,6 @@ extern const struct ad7606_chip_info ad7608_info;
>  extern const struct ad7606_chip_info ad7609_info;
>  extern const struct ad7606_chip_info ad7616_info;
>  
> -#ifdef CONFIG_PM_SLEEP
>  extern const struct dev_pm_ops ad7606_pm_ops;
> -#define AD7606_PM_OPS (&ad7606_pm_ops)
> -#else
> -#define AD7606_PM_OPS NULL
> -#endif
>  
>  #endif /* IIO_ADC_AD7606_H_ */
> diff --git a/drivers/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c
> index 5b137e947f0b..986c15db90c7 100644
> --- a/drivers/iio/adc/ad7606_par.c
> +++ b/drivers/iio/adc/ad7606_par.c
> @@ -11,6 +11,7 @@
>  #include <linux/io.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> +#include <linux/pm.h>
>  #include <linux/property.h>
>  #include <linux/types.h>
>  
> @@ -251,7 +252,7 @@ static struct platform_driver ad7606_driver = {
>  	.id_table = ad7606_driver_ids,
>  	.driver = {
>  		.name = "ad7606",
> -		.pm = AD7606_PM_OPS,
> +		.pm = pm_sleep_ptr(&ad7606_pm_ops),
>  		.of_match_table = ad7606_of_match,
>  	},
>  };
> diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
> index 8c479fa50a23..10df12311561 100644
> --- a/drivers/iio/adc/ad7606_spi.c
> +++ b/drivers/iio/adc/ad7606_spi.c
> @@ -9,6 +9,7 @@
>  #include <linux/err.h>
>  #include <linux/math.h>
>  #include <linux/module.h>
> +#include <linux/pm.h>
>  #include <linux/pwm.h>
>  #include <linux/spi/offload/consumer.h>
>  #include <linux/spi/offload/provider.h>
> @@ -502,7 +503,7 @@ static struct spi_driver ad7606_driver = {
>  	.driver = {
>  		.name = "ad7606",
>  		.of_match_table = ad7606_of_match,
> -		.pm = AD7606_PM_OPS,
> +		.pm = pm_sleep_ptr(&ad7606_pm_ops),
>  	},
>  	.probe = ad7606_spi_probe,
>  	.id_table = ad7606_id_table,
> -- 
> 2.54.0
> 

      parent reply	other threads:[~2026-10-16  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 15:19 [PATCH] iio: adc: ad7606: use EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Abdelnasser Hussein
2026-10-15 18:44 ` Andy Shevchenko
2026-10-16  9:25 ` Nuno Sá [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=atHtenc-1IRYSRGU@nsa \
    --to=nuno.sa@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=abdelnasserhussein11@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.