[PATCH v5 00/14] gpio: Use modern PM macros

Jisheng Zhang posted 14 patches 1 week, 1 day ago
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-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 +++++++--------
14 files changed, 70 insertions(+), 109 deletions(-)
[PATCH v5 00/14] gpio: Use modern PM macros
Posted by Jisheng Zhang 1 week, 1 day 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 v4:
  - collect Reviewed-by tags.
  - use pm_ptr() instead of pm_sleep_ptr() for gpio-tqmx86 
  - drop patch5 for gpio-pxa due to maintainer's conern with memory waste

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 (14):
  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: 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-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 +++++++--------
 14 files changed, 70 insertions(+), 109 deletions(-)

-- 
2.51.0
Re: [PATCH v5 00/14] gpio: Use modern PM macros
Posted by Bartosz Golaszewski 6 days, 11 hours ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Mon, 24 Nov 2025 08:20:51 +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.
> 
> [...]

Let's give it some time in linux-next to spot any potential build issues.

[01/14] gpio: dwapb: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/3f19e57cbfb55d743d60aeebf5d5c48cc7fd5d4e
[02/14] gpio: brcmstb: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/56f3a6d7538d2e0dfb8d9df7871d2a9aec3115ac
[03/14] gpio: htc-egpio: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/2557b1f4f21a75650a03c74a56ea30bd4214866e
[04/14] gpio: pl061: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/b40c4dacf48a42ddcd701552575945e90f5c8060
[05/14] gpio: ml-ioh: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/1f37a9f7d1fa582833cc8e226d77e5b2397df9fa
[06/14] gpio: mlxbf2: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/a92f492a1473eb2255be9b7b767d0720c5c3b2a9
[07/14] gpio: msc313: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/07a251bfe3b690ebfaef7c46f6ce25ea9ccba8da
[08/14] gpio: omap: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/2b3c8bd8e13bd101fe8833b1f02ef5e5a6e9920b
[09/14] gpio: pch: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/0ed358a87d6ef9782dca161ef3f1311d21f257d2
[10/14] gpio: tqmx86: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/75ff16234bf3af747b9c77b81d7ce3df5c09df8c
[11/14] gpio: uniphier: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/46e90d3924cb58b161c2dd57ba05f3a706c1c0e2
[12/14] gpio: xgene: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/353fdaebdc6991f1cf03ae3aaec266ad0516859b
[13/14] gpio: xilinx: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/dbedf93d1082b4e755eb62338e5f6566f4e31fb8
[14/14] gpio: zynq: Use modern PM macros
        https://git.kernel.org/brgl/linux/c/23ac52a4a2dceb704d8dc1674abb8beefd93bf1a

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>