[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdX9nkROkAJJ5odv4qOWe0bFTmaFs=Rfxsfuc9+DT-bsEQ@mail.gmail.com>
Date: Mon, 28 Jul 2025 09:35:32 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Raphael Gallais-Pou <rgallaispou@...il.com>
Cc: Mark Brown <broonie@...nel.org>, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
Hi Raphael,
On Tue, 10 Jun 2025 at 16:59, Raphael Gallais-Pou <rgallaispou@...il.com> wrote:
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM_SLEEP support is simpler and less error prone than the
> use of #ifdef based kernel configuration guards.
>
> Signed-off-by: Raphael Gallais-Pou <rgallaispou@...il.com>
Thanks for your patch, which is now commit 7d61715c58a39edc ("spi:
rspi: Convert to DEFINE_SIMPLE_DEV_PM_OPS()") in spi/for-next.
> --- a/drivers/spi/spi-st-ssc4.c
> +++ b/drivers/spi/spi-st-ssc4.c
> @@ -378,8 +378,7 @@ static void spi_st_remove(struct platform_device *pdev)
> pinctrl_pm_select_sleep_state(&pdev->dev);
> }
>
> -#ifdef CONFIG_PM
> -static int spi_st_runtime_suspend(struct device *dev)
> +static int __maybe_unused spi_st_runtime_suspend(struct device *dev)
The __maybe_unused can be removed, too...
> @@ -429,7 +426,6 @@ static int spi_st_resume(struct device *dev)
>
> return pm_runtime_force_resume(dev);
> }
> -#endif
>
> static const struct dev_pm_ops spi_st_pm = {
> SET_SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
... if you would update these, too:
- SET_SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
- SET_RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL)
+ SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
+ RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL)
> @@ -445,7 +441,7 @@ MODULE_DEVICE_TABLE(of, stm_spi_match);
> static struct platform_driver spi_st_driver = {
> .driver = {
> .name = "spi-st",
> - .pm = &spi_st_pm,
> + .pm = pm_sleep_ptr(&spi_st_pm),
This should use pm_ptr() instead, as spi_st_pm defines not only system
sleep ops, but also Runtime PM ops.
> .of_match_table = of_match_ptr(stm_spi_match),
> },
> .probe = spi_st_probe,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists