[PATCH v2 0/8] gpio: move generic GPIO chip fields out of the top-level gpio_chip struct

Bartosz Golaszewski posted 8 patches 3 months, 1 week ago
drivers/gpio/gpio-74xx-mmio.c |  32 +++++------
drivers/gpio/gpio-cadence.c   |  60 ++++++++++-----------
drivers/gpio/gpio-clps711x.c  |  27 ++++++----
drivers/gpio/gpio-en7523.c    |  36 ++++++-------
drivers/gpio/gpio-mxc.c       |  87 +++++++++++++++---------------
include/linux/gpio/generic.h  | 120 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 243 insertions(+), 119 deletions(-)
[PATCH v2 0/8] gpio: move generic GPIO chip fields out of the top-level gpio_chip struct
Posted by Bartosz Golaszewski 3 months, 1 week ago
The conversion of GPIO drivers to using the new line value setters is
moving nicely along and we're on track to have all the existing
providers converted upstream after the next merge window. There's
another piece of technical debt that bothers me - the fact that struct
gpio_chip contains a bunch of fields that are only relevant to the
generic GPIO chip implementation from gpio-mmio.c.

Let's work towards moving them out of struct gpio_chip and into their
own struct gpio_generic_chip. Doing this in a single series would
require some ~40 commits which is way too many to review at a time.
There are also users of gpio-mmio under drivers/pinctrl/ and
drivers/mfd/ which would require cross-subsystem merges. I think it's
better to do this in stages over 3 release cycles. This series adds a
new API for gpio-mmio users, hiding the implementation details and
converts the first set of GPIO drivers. Once upstream, we'll convert all
remaining users and once that's done, we'll move all the
gpio-mmio-specific fields to the new structure, convert the internals to
using them and remove bgpio_init(). The last step will be done in a
backward-compatible way, not affecting the users.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Changes in v2:
- rebase on top of recent driver changes
- pick up review tags
- Link to v1: https://lore.kernel.org/r/20250624-gpio-mmio-rework-v1-0-aea12209d258@linaro.org

---
Bartosz Golaszewski (8):
      gpio: generic: add new generic GPIO chip API
      gpio: mxc: use lock guards for the generic GPIO chip lock
      gpio: mxc: use new generic GPIO chip API
      gpio: clps711x: use new generic GPIO chip API
      gpio: cadence: use lock guards
      gpio: cadence: use new generic GPIO chip API
      gpio: 74xx-mmio: use new generic GPIO chip API
      gpio: en7523: use new generic GPIO chip API

 drivers/gpio/gpio-74xx-mmio.c |  32 +++++------
 drivers/gpio/gpio-cadence.c   |  60 ++++++++++-----------
 drivers/gpio/gpio-clps711x.c  |  27 ++++++----
 drivers/gpio/gpio-en7523.c    |  36 ++++++-------
 drivers/gpio/gpio-mxc.c       |  87 +++++++++++++++---------------
 include/linux/gpio/generic.h  | 120 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 243 insertions(+), 119 deletions(-)
---
base-commit: 3f804361f3b9af33e00b90ec9cb5afcc96831e60
change-id: 20250606-gpio-mmio-rework-a2f4c439aa96

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Re: [PATCH v2 0/8] gpio: move generic GPIO chip fields out of the top-level gpio_chip struct
Posted by Bartosz Golaszewski 3 months ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Wed, 02 Jul 2025 11:22:07 +0200, Bartosz Golaszewski wrote:
> The conversion of GPIO drivers to using the new line value setters is
> moving nicely along and we're on track to have all the existing
> providers converted upstream after the next merge window. There's
> another piece of technical debt that bothers me - the fact that struct
> gpio_chip contains a bunch of fields that are only relevant to the
> generic GPIO chip implementation from gpio-mmio.c.
> 
> [...]

Applied, thanks!

[1/8] gpio: generic: add new generic GPIO chip API
      https://git.kernel.org/brgl/linux/c/8595375e4fded27de24b189c692c2c50051a7b3b
[2/8] gpio: mxc: use lock guards for the generic GPIO chip lock
      https://git.kernel.org/brgl/linux/c/ba441322c7aac4735d78fc6781e497a01fb8eac7
[3/8] gpio: mxc: use new generic GPIO chip API
      https://git.kernel.org/brgl/linux/c/1f129b15c2dea84ce12ee3120c7fffdb7bfc7395
[4/8] gpio: clps711x: use new generic GPIO chip API
      https://git.kernel.org/brgl/linux/c/fd0f0d1a1e71d736deed3593470b3b03f8e76df7
[5/8] gpio: cadence: use lock guards
      https://git.kernel.org/brgl/linux/c/76045e90400b7ecc60a33526a505124b0cce1d7a
[6/8] gpio: cadence: use new generic GPIO chip API
      https://git.kernel.org/brgl/linux/c/47ecff3839cac71c6b7f89b7860f6f76a4c07b65
[7/8] gpio: 74xx-mmio: use new generic GPIO chip API
      https://git.kernel.org/brgl/linux/c/bd9a0dec2d49836e7d186642600e0f668fab33ed
[8/8] gpio: en7523: use new generic GPIO chip API
      https://git.kernel.org/brgl/linux/c/34c029c20300b9b3072f40875b899ef9c40e69cc

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