Skip to content

gpio: regmap: IRQ domain cleanups

Michael Walle linux-arm-kernel linux-gpio 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13gpio: regmap: remove gpiochip before tearing down irqchipdrivers/gpio/gpio-regmap.c+8 -10 replies
2/13gpio: regmap: add a callback to create the IRQ domaindrivers/gpio/gpio-regmap.c include/linux/gpio/regmap.h+28 -30 replies
3/13gpio: rtd1625: create the IRQ domain from the gpio-regmap callbackdrivers/gpio/gpio-rtd1625.c+41 -330 replies
4/13gpio: axiado-sgpio: create the IRQ domain from the gpio-regmap callbackdrivers/gpio/gpio-axiado-sgpio.c+37 -270 replies
5/13gpio: regmap: add a helper to add a regmap-irq chipdrivers/gpio/gpio-regmap.c include/linux/gpio/regmap.h+58 -00 replies
6/13gpio: max7360: create the regmap-irq chip from the gpio-regmap callbackdrivers/gpio/gpio-max7360.c+41 -210 replies
7/13gpio: sl28cpld: create the regmap-irq chip from the gpio-regmap callbackdrivers/gpio/gpio-sl28cpld.c+23 -110 replies
8/13gpio: idio-16: create the regmap-irq chip from the gpio-regmap callbackdrivers/gpio/gpio-idio-16.c+20 -80 replies
9/13gpio: pcie-idio-24: create the regmap-irq chip from the gpio-regmap callbackdrivers/gpio/gpio-pcie-idio-24.c+25 -110 replies
10/13gpio: ws16c48: create the regmap-irq chip from the gpio-regmap callbackdrivers/gpio/gpio-ws16c48.c+25 -110 replies
11/13gpio: 104-idi-48: create the regmap-irq chip from the gpio-regmap callbackdrivers/gpio/gpio-104-idi-48.c+28 -100 replies
12/13gpio: i8255: create the regmap-irq chip from the gpio-regmap callbackdrivers/gpio/gpio-104-dio-48e.c drivers/gpio/gpio-i8255.c drivers/gpio/gpio-i8255.h+31 -110 replies
13/13gpio: regmap: remove irq_domain and the regmap-irq configurationdrivers/gpio/gpio-regmap.c include/linux/gpio/regmap.h+4 -470 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFT PATCH 00/13] gpio: regmap: IRQ domain cleanups

The gpio-regmap provides two different variants to attach an IRQ domain to the gpio-regmap instance, either via .irq_domain or via .regmap_irq_chip. The former even has a small window where a consumer requesting an interrupt leads to a NULL pointer dereference. This also came up during sashiko reviews [1].

It turns out, that it is impossible to create an external IRQ domain without a race while the gpio-regmap instance isn't created yet. That is because it will already use the gpio-regmap provided callbacks. Thus, with this patch series, gpio-regmap will now provide a callback for the individual drivers used to create an IRQ domain when all necessary fields are filled.

To move even further and cover the most common use case of having a regmap-irq domain, gpio-regmap now provides a helper that can be used in the .create_irq_domain() callback.

We need Long Zhao's patch [2] not only for ACPI but also for the regmap-irq handling. If the IRQ domain is removed before the gpio_chip, gpiochip_remove() would use the already freed domain to free the remaining interrupts.

All the users of regmap-irq are switched over to this new helper. Finally, the last patch, removes the old variants.

There is one change in behavior: because all regmap-irq domains use the gpio_regmap_irq_{reqres,relres}() helpers now, interrupt lines are now locked and cannot be switched to output. But that shouldn't be an issue anyway.

This was mostly only compile-time tested. So please test. I'll do a proper test on the sl28 board tomorrow, but since Long already asked, I wanted to have this out for comments and testing.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]

Long Zhao (1):
gpio: regmap: remove gpiochip before tearing down irqchip

Michael Walle (12):
gpio: regmap: add a callback to create the IRQ domain
gpio: rtd1625: create the IRQ domain from the gpio-regmap callback
gpio: axiado-sgpio: create the IRQ domain from the gpio-regmap
callback
gpio: regmap: add a helper to add a regmap-irq chip
gpio: max7360: create the regmap-irq chip from the gpio-regmap
callback
gpio: sl28cpld: create the regmap-irq chip from the gpio-regmap
callback
gpio: idio-16: create the regmap-irq chip from the gpio-regmap
callback
gpio: pcie-idio-24: create the regmap-irq chip from the gpio-regmap
callback
gpio: ws16c48: create the regmap-irq chip from the gpio-regmap
callback
gpio: 104-idi-48: create the regmap-irq chip from the gpio-regmap
callback
gpio: i8255: create the regmap-irq chip from the gpio-regmap callback
gpio: regmap: remove irq_domain and the regmap-irq configuration

 drivers/gpio/gpio-104-dio-48e.c  | 31 +++++++++----
 drivers/gpio/gpio-104-idi-48.c   | 38 +++++++++++----
 drivers/gpio/gpio-axiado-sgpio.c | 64 +++++++++++++++-----------
 drivers/gpio/gpio-i8255.c        |  3 +-
 drivers/gpio/gpio-i8255.h        |  8 +++-
 drivers/gpio/gpio-idio-16.c      | 28 +++++++----
 drivers/gpio/gpio-max7360.c      | 62 ++++++++++++++++---------
 drivers/gpio/gpio-pcie-idio-24.c | 36 ++++++++++-----
 drivers/gpio/gpio-regmap.c       | 79 ++++++++++++++++++++++++--------
 drivers/gpio/gpio-rtd1625.c      | 74 +++++++++++++++++-------------
 drivers/gpio/gpio-sl28cpld.c     | 34 +++++++++-----
 drivers/gpio/gpio-ws16c48.c      | 36 ++++++++++-----
 include/linux/gpio/regmap.h      | 34 ++++++++------
 13 files changed, 351 insertions(+), 176 deletions(-)
Signature · 1 line
2.47.3