[PATCH RFC 0/9] gpio: make irq_chip immutable

Peng Fan (OSS) posted 9 patches 9 months ago
drivers/gpio/gpio-bcm-kona.c   |  1 +
drivers/gpio/gpio-davinci.c    | 29 ++++++++++++++---------------
drivers/gpio/gpio-grgpio.c     |  7 ++++++-
drivers/gpio/gpio-lpc18xx.c    | 13 +++++++++++--
drivers/gpio/gpio-mpc8xxx.c    |  8 ++++++++
drivers/gpio/gpio-pxa.c        |  8 +++++++-
drivers/gpio/gpio-timberdale.c | 10 +++++++++-
drivers/gpio/gpio-xgene-sb.c   | 26 +++++++++++++++++++++++---
8 files changed, 79 insertions(+), 23 deletions(-)
[PATCH RFC 0/9] gpio: make irq_chip immutable
Posted by Peng Fan (OSS) 9 months ago
This might be a bit late to post this patchset, since it is almost rc6,
but no rush here. Not expect this patchset be in 6.16.

This is an effort to make irq_chip immutable to elimnate the kernel
warning "not an immutable chip, please consider fixing!"

The major changes 
- add "gpiochip_disable_irq(gc, hwirq)" to end of mask hook
- add "gpiochip_enable_irq(gc, hwirq)" to start of unmask hook
- add IMMUTABLE flag
- add GPIOCHIP_IRQ_RESOURCE_HELPERS

For davinci, two patches are made, 1st is to update irq chip data, 2nd
make irq_chip immutable.
For xgene-sb, two functions are added, because previous driver directly
use irq_chip_unmask_parent and irq_chip_mask_parent.

In some patches, I use irqd_to_hwirq(d) to get hwirq; in others, I
direclty use d->hwirq to align with previous code.

Some Kconfig entries do not select GPILIB_IRQCHIP, but I tried
to build pxa_defconfig lpc18xx_defconfig and multi_v7_defconfig,
GPIOLIB_IRQCHIP is y.
Not sure we should select GPIOLIB_IRQCHIP for them, because if
deselect GPIOLIB_IRQCHIP, there will be build failure.

I not have platform to test the code, just best effort to do this
patchset.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (9):
      gpio: bcm-kona: make irq_chip immutable
      gpio: grgpio: Make irq_chip immutable
      gpio: lpc18xx: Make irq_chip immutable
      gpio: mpc8xxx: Make irq_chip immutable
      gpio: davinci: Update irq chip data
      gpio: davinci: Make irq_chip immutable
      gpio: xgene-sb: Make irq_chip immutable
      gpio: timberdale: Make irq_chip immutable
      gpio: pxa: Make irq_chip immutable

 drivers/gpio/gpio-bcm-kona.c   |  1 +
 drivers/gpio/gpio-davinci.c    | 29 ++++++++++++++---------------
 drivers/gpio/gpio-grgpio.c     |  7 ++++++-
 drivers/gpio/gpio-lpc18xx.c    | 13 +++++++++++--
 drivers/gpio/gpio-mpc8xxx.c    |  8 ++++++++
 drivers/gpio/gpio-pxa.c        |  8 +++++++-
 drivers/gpio/gpio-timberdale.c | 10 +++++++++-
 drivers/gpio/gpio-xgene-sb.c   | 26 +++++++++++++++++++++++---
 8 files changed, 79 insertions(+), 23 deletions(-)
---
base-commit: f48887a98b78880b7711aca311fbbbcaad6c4e3b
change-id: 20250509-gpio-c09a49e972ba

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>
Re: [PATCH RFC 0/9] gpio: make irq_chip immutable
Posted by Bartosz Golaszewski 8 months, 4 weeks ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Fri, 09 May 2025 12:45:31 +0800, Peng Fan (OSS) wrote:
> This might be a bit late to post this patchset, since it is almost rc6,
> but no rush here. Not expect this patchset be in 6.16.
> 
> This is an effort to make irq_chip immutable to elimnate the kernel
> warning "not an immutable chip, please consider fixing!"
> 
> The major changes
> - add "gpiochip_disable_irq(gc, hwirq)" to end of mask hook
> - add "gpiochip_enable_irq(gc, hwirq)" to start of unmask hook
> - add IMMUTABLE flag
> - add GPIOCHIP_IRQ_RESOURCE_HELPERS
> 
> [...]

Applied, thanks!

[1/9] gpio: bcm-kona: make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/7b04f98027afd2cc329d00191dfc8284b382565d
[2/9] gpio: grgpio: Make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/a30be40bf1d4437646b6885e7e4e71530e6f82c1
[3/9] gpio: lpc18xx: Make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/289e42df1358abf85e49a140f7224c2abd170b2e
[4/9] gpio: mpc8xxx: Make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/7688a54d5b53f2e3160c00f19b00bc601fa3ec98
[5/9] gpio: davinci: Update irq chip data
      https://git.kernel.org/brgl/linux/c/62be72bdb00ef52a0d0f02ce077e36b1f48ef0ae
[6/9] gpio: davinci: Make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/3f50bb3124d76653de0bcfe251faa357711e3ae6
[7/9] gpio: xgene-sb: Make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/580b3264cb252cae00fa62d58443af09c25f7d61
[8/9] gpio: timberdale: Make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/2993d2dd8ff4e8257a88d4d3f8ffc6df95928b94
[9/9] gpio: pxa: Make irq_chip immutable
      https://git.kernel.org/brgl/linux/c/20117cf426b677e7aced4e7a1b2b37f6080a46dc

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Re: [PATCH RFC 0/9] gpio: make irq_chip immutable
Posted by Linus Walleij 9 months ago
On Fri, May 9, 2025 at 6:47 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:

> This might be a bit late to post this patchset, since it is almost rc6,
> but no rush here. Not expect this patchset be in 6.16.

The series:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

I agree with Andy, why not just apply this, these drivers have
had long time to adopt to immutable GPIO chip and your
patches are generously helping them to migrate. If things
break for these users they can fix it in the rc:s, and if there
are no users testing these, well that's a community problem.

But there can be some fallout, so it's your pick!

Yours,
Linus Walleij
Re: [PATCH RFC 0/9] gpio: make irq_chip immutable
Posted by Andy Shevchenko 9 months ago
Fri, May 09, 2025 at 12:45:31PM +0800, Peng Fan (OSS) kirjoitti:
> This might be a bit late to post this patchset, since it is almost rc6,
> but no rush here. Not expect this patchset be in 6.16.

Why not? These are mostly trivial ones and they fix the warning, they may
potentially be the fixes between -rc1 and -rc2,

> This is an effort to make irq_chip immutable to elimnate the kernel
> warning "not an immutable chip, please consider fixing!"

> The major changes 
> - add "gpiochip_disable_irq(gc, hwirq)" to end of mask hook
> - add "gpiochip_enable_irq(gc, hwirq)" to start of unmask hook
> - add IMMUTABLE flag
> - add GPIOCHIP_IRQ_RESOURCE_HELPERS

No need to list the implementation details of IMMUTABLE flag. Just a summary
line is enough.

> For davinci, two patches are made, 1st is to update irq chip data, 2nd
> make irq_chip immutable.
> For xgene-sb, two functions are added, because previous driver directly
> use irq_chip_unmask_parent and irq_chip_mask_parent.
> 
> In some patches, I use irqd_to_hwirq(d) to get hwirq; in others, I
> direclty use d->hwirq to align with previous code.
> 
> Some Kconfig entries do not select GPILIB_IRQCHIP, but I tried
> to build pxa_defconfig lpc18xx_defconfig and multi_v7_defconfig,
> GPIOLIB_IRQCHIP is y.
> Not sure we should select GPIOLIB_IRQCHIP for them, because if
> deselect GPIOLIB_IRQCHIP, there will be build failure.

-- 
With Best Regards,
Andy Shevchenko