All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Paul Cercueil <paul@crapouillou.net>,
	Arnd Bergmann <arnd@arndb.de>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
Date: Mon, 21 Feb 2022 19:36:25 +0000	[thread overview]
Message-ID: <20220221193625.7bb5f8a9@jic23-huawei> (raw)
In-Reply-To: <20220130193147.279148-44-jic23@kernel.org>

On Sun, 30 Jan 2022 19:31:40 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM support is simpler and less error prone than the
> use of #ifdef based config guards.
> 
> This case uses the new DEFINE_RUNTIME_DEV_PM_OPS() to reduce
> boilerplate.
> 
> Removing instances of this approach from IIO also stops them being
> copied into new drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/iio/adc/ab8500-gpadc.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
> index 4c46a201d4ef..78c2bd8bb91d 100644
> --- a/drivers/iio/adc/ab8500-gpadc.c
> +++ b/drivers/iio/adc/ab8500-gpadc.c
> @@ -942,7 +942,6 @@ static const struct iio_info ab8500_gpadc_info = {
>  	.read_raw = ab8500_gpadc_read_raw,
>  };
>  
> -#ifdef CONFIG_PM
>  static int ab8500_gpadc_runtime_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> @@ -965,7 +964,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev)
>  
>  	return ret;
>  }
> -#endif
>  
>  /**
>   * ab8500_gpadc_parse_channel() - process devicetree channel configuration
> @@ -1199,20 +1197,15 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static const struct dev_pm_ops ab8500_gpadc_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> -				pm_runtime_force_resume)
> -	SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend,
> -			   ab8500_gpadc_runtime_resume,
> -			   NULL)
> -};
> +static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_runtime_suspend,
0-day actually managed to build this driver unlike my test setups.
Anyhow, I managed to lose the name of the dev_pm_ops structure.

I've fixed that up and tested by hacking out the dependencies in Kconfig.
At somepoint I'll check if we can actually add a COMPILE_TEST option
for this one or if there are some actual requirements that my really
quick test didn't pick up on.

Fresh testing branch pushed out.

> +				 ab8500_gpadc_runtime_resume, NULL);
>  
>  static struct platform_driver ab8500_gpadc_driver = {
>  	.probe = ab8500_gpadc_probe,
>  	.remove = ab8500_gpadc_remove,
>  	.driver = {
>  		.name = "ab8500-gpadc",
> -		.pm = &ab8500_gpadc_pm_ops,
> +		.pm = pm_ptr(&ab8500_gpadc_pm_ops),
>  	},
>  };
>  builtin_platform_driver(ab8500_gpadc_driver);


  reply	other threads:[~2022-02-21 19:29 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
2022-01-30 19:30 ` [PATCH v3 01/50] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:30 ` [PATCH v3 02/50] iio:accel:da280: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 03/50] iio:accel:dmard06: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 04/50] iio:accel:dmard10: Switch from CONFIG_PM " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 05/50] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 06/50] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 07/50] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 08/50] iio:accel:mma9553: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 09/50] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 10/50] iio:adc:at91-adc: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 11/50] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 12/50] iio:adc:palmas_gpadc: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 13/50] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 14/50] iio:adc:twl6030: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 15/50] iio:adc:vf610: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 16/50] iio:common:ssp: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 17/50] iio:dac:vf610: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 18/50] iio:light:apds9300: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 19/50] iio:light:cm3232: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 20/50] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 21/50] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 22/50] iio:light:jsa1212: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 23/50] iio:light:ltr501: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 24/50] iio:light:stk3310: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 25/50] iio:light:tcs3414: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 26/50] iio:light:tcs3472: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 27/50] iio:light:tsl2563: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 28/50] iio:light:tsl4531: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 29/50] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 30/50] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 31/50] iio:magn:mmc35240: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 32/50] iio:pressure:mpl3115: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 33/50] iio:proximity:as3935: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 34/50] iio:proximity:rfd77492: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 35/50] iio:proximity:sx9500: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 36/50] iio:temperature:tmp006: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 37/50] iio:temperature:tmp007: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 38/50] iio:accel:stk8312: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 39/50] iio:accel:bma180: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 40/50] iio:dac:m62332: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 41/50] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 42/50] iio:temperature:mlx90614: " Jonathan Cameron
2022-01-31 13:16   ` Crt Mori
2022-01-30 19:31 ` [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM " Jonathan Cameron
2022-02-21 19:36   ` Jonathan Cameron [this message]
2022-01-30 19:31 ` [PATCH v3 44/50] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 45/50] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 46/50] iio:light:bh1780: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 47/50] iio:proximity:pulsedlight: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 48/50] iio:chemical:atlas: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 49/50] iio:light:rpr0521: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused Jonathan Cameron
2022-02-09 14:04   ` Fabrice Gasnier
2022-01-31 13:33 ` [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Arnd Bergmann
2022-02-09 11:41 ` Paul Cercueil
2022-02-18 11:47   ` Jonathan Cameron

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=20220221193625.7bb5f8a9@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=arnd@arndb.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=rafael@kernel.org \
    /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.