[PATCH v4 00/15] gpio: Use modern PM macros

Jisheng Zhang posted 15 patches 1 week, 5 days ago
There is a newer version of this series
drivers/gpio/gpio-brcmstb.c   | 12 +++---------
drivers/gpio/gpio-dwapb.c     | 18 ++++--------------
drivers/gpio/gpio-htc-egpio.c | 21 ++++++++-------------
drivers/gpio/gpio-ml-ioh.c    | 12 ++++++------
drivers/gpio/gpio-mlxbf2.c    |  8 ++++----
drivers/gpio/gpio-msc313.c    |  8 ++++----
drivers/gpio/gpio-omap.c      | 15 +++++++--------
drivers/gpio/gpio-pch.c       | 12 ++++++------
drivers/gpio/gpio-pl061.c     | 17 ++---------------
drivers/gpio/gpio-pxa.c       | 11 ++---------
drivers/gpio/gpio-tqmx86.c    |  9 ++++-----
drivers/gpio/gpio-uniphier.c  |  9 ++++-----
drivers/gpio/gpio-xgene.c     |  8 ++++----
drivers/gpio/gpio-xilinx.c    | 15 +++++++--------
drivers/gpio/gpio-zynq.c      | 15 +++++++--------
15 files changed, 72 insertions(+), 118 deletions(-)
[PATCH v4 00/15] gpio: Use modern PM macros
Posted by Jisheng Zhang 1 week, 5 days ago
Use the modern PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards or
__maybe_unused.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Almost all drivers are converted, only gpio-tegra and gpio-mlxbf are
left as is, because the memory for saving HW context is not trivial,
if we convert them, then the two drivers' users may complain for
!CONFIG_PM && !CONFIG_PM_SLEEP case. So I didn't touch them.

patch to gpio-dwapb.c is tested on real HW, others are compile-tested only.

since v3:
  - fix typos.
  - fix the stray change in gpio-pxa driver.

since v2:
  - collect Acked-by, Reviewed-by tags.
  - move the embeddng the structure for pm in gpio-dwapb out, will send
    it as a separate patch.

since v1:
  - rebase on the latest gpio/for-next branch.
  - collect Acked-by, Reviewed-by tags.
  - clarify the trival memory wasted numbers with CONFIG_PM=n in the
    dwapb's patch commit message as suggested by Andy.
  - drop patch to bt8xxx since the clean up is acchieved when switching
    to generic PCI pm framework.


Jisheng Zhang (15):
  gpio: dwapb: Use modern PM macros
  gpio: brcmstb: Use modern PM macros
  gpio: htc-egpio: Use modern PM macros
  gpio: pl061: Use modern PM macros
  gpio: pxa: Use modern PM macros
  gpio: ml-ioh: Use modern PM macros
  gpio: mlxbf2: Use modern PM macros
  gpio: msc313: Use modern PM macros
  gpio: omap: Use modern PM macros
  gpio: pch: Use modern PM macros
  gpio: tqmx86: Use modern PM macros
  gpio: uniphier: Use modern PM macros
  gpio: xgene: Use modern PM macros
  gpio: xilinx: Use modern PM macros
  gpio: zynq: Use modern PM macros

 drivers/gpio/gpio-brcmstb.c   | 12 +++---------
 drivers/gpio/gpio-dwapb.c     | 18 ++++--------------
 drivers/gpio/gpio-htc-egpio.c | 21 ++++++++-------------
 drivers/gpio/gpio-ml-ioh.c    | 12 ++++++------
 drivers/gpio/gpio-mlxbf2.c    |  8 ++++----
 drivers/gpio/gpio-msc313.c    |  8 ++++----
 drivers/gpio/gpio-omap.c      | 15 +++++++--------
 drivers/gpio/gpio-pch.c       | 12 ++++++------
 drivers/gpio/gpio-pl061.c     | 17 ++---------------
 drivers/gpio/gpio-pxa.c       | 11 ++---------
 drivers/gpio/gpio-tqmx86.c    |  9 ++++-----
 drivers/gpio/gpio-uniphier.c  |  9 ++++-----
 drivers/gpio/gpio-xgene.c     |  8 ++++----
 drivers/gpio/gpio-xilinx.c    | 15 +++++++--------
 drivers/gpio/gpio-zynq.c      | 15 +++++++--------
 15 files changed, 72 insertions(+), 118 deletions(-)

-- 
2.51.0
Re: [PATCH v4 00/15] gpio: Use modern PM macros
Posted by Bartosz Golaszewski 1 week, 5 days ago
On Wed, Nov 19, 2025 at 5:51 PM Jisheng Zhang <jszhang@kernel.org> wrote:
>
> Use the modern PM macros for the suspend and resume functions to be
> automatically dropped by the compiler when CONFIG_PM or
> CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards or
> __maybe_unused.
>
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.
>
> Almost all drivers are converted, only gpio-tegra and gpio-mlxbf are
> left as is, because the memory for saving HW context is not trivial,
> if we convert them, then the two drivers' users may complain for
> !CONFIG_PM && !CONFIG_PM_SLEEP case. So I didn't touch them.
>
> patch to gpio-dwapb.c is tested on real HW, others are compile-tested only.
>

Please don't submit a new version of a 15 patch series every couple hours. :/

Give people time to review.

Bart
Re: [PATCH v4 00/15] gpio: Use modern PM macros
Posted by Andy Shevchenko 1 week, 5 days ago
On Thu, Nov 20, 2025 at 12:33:12AM +0800, Jisheng Zhang wrote:
> Use the modern PM macros for the suspend and resume functions to be
> automatically dropped by the compiler when CONFIG_PM or
> CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards or
> __maybe_unused.
> 
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.
> 
> Almost all drivers are converted, only gpio-tegra and gpio-mlxbf are
> left as is, because the memory for saving HW context is not trivial,
> if we convert them, then the two drivers' users may complain for
> !CONFIG_PM && !CONFIG_PM_SLEEP case. So I didn't touch them.
> 
> patch to gpio-dwapb.c is tested on real HW, others are compile-tested only.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
except patches 2, 5, and 11.

-- 
With Best Regards,
Andy Shevchenko