* [PATCH] pinctrl: keembay: make keembay_gpio_irqchip const
@ 2026-11-02 21:25 Areeb Ul Haq Mirza
2026-11-05 9:14 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Areeb Ul Haq Mirza @ 2026-11-02 21:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Areeb Ul Haq Mirza
gpiolib warns about mutable irq_chips at probe time:
"not an immutable chip, please consider fixing it!"
Make keembay_gpio_irqchip const, flag it as IRQCHIP_IMMUTABLE, add the
GPIOCHIP_IRQ_RESOURCE_HELPERS and register it with
gpio_irq_chip_set_chip().
The chip only implements .irq_enable() and .irq_disable(), so call
gpiochip_enable_irq() and gpiochip_disable_irq() from those callbacks,
following commit 35d008679a5a ("pinctrl: plgpio: Convert to immutable
irq_chip") [1] and commit 2993d2dd8ff4 ("gpio: timberdale: Make irq_chip
immutable") [2]. gpiochip_enable_irq() is called once a free interrupt
source and slot have been found, so a line is only marked enabled when
it is actually routed. gpiochip_disable_irq() is called after the line
has been cleared from the interrupt configuration register.
Link: https://lore.kernel.org/r/20230414-immutable-irqchips-2-v1-3-6b59a5186b00@linaro.org [1]
Link: https://lore.kernel.org/r/20250509-gpio-v1-8-639377c98288@nxp.com [2]
Signed-off-by: Areeb Ul Haq Mirza <auhmirza02@gmail.com>
---
Compile-tested only (arm64, W=1, sparse).
drivers/pinctrl/pinctrl-keembay.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index 3241d3ae6219..486577458883 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -1380,6 +1380,8 @@ static void keembay_gpio_irq_enable(struct irq_data *data)
if (src < 0 || slot < 0)
return;
+ gpiochip_enable_irq(gc, pin);
+
if (trig & KEEMBAY_GPIO_SENSE_LOW)
keembay_gpio_invert(kpc, pin);
@@ -1412,6 +1414,7 @@ static void keembay_gpio_irq_disable(struct irq_data *data)
for_each_set_clump8(pos, clump, ®, BITS_PER_TYPE(typeof(reg))) {
if ((clump & ~KEEMBAY_GPIO_IRQ_ENABLE) == pin) {
keembay_gpio_clear_irq(data, pos, src, pin);
+ gpiochip_disable_irq(gc, pin);
return;
}
}
@@ -1451,12 +1454,14 @@ static int keembay_gpio_add_pin_ranges(struct gpio_chip *chip)
return ret;
}
-static struct irq_chip keembay_gpio_irqchip = {
+static const struct irq_chip keembay_gpio_irqchip = {
.name = "keembay-gpio",
.irq_enable = keembay_gpio_irq_enable,
.irq_disable = keembay_gpio_irq_disable,
.irq_set_type = keembay_gpio_irq_set_type,
.irq_ack = keembay_gpio_irq_ack,
+ .flags = IRQCHIP_IMMUTABLE,
+ GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc,
@@ -1468,7 +1473,7 @@ static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc,
/* Setup GPIO IRQ chip */
girq = &kpc->chip.irq;
- girq->chip = &keembay_gpio_irqchip;
+ gpio_irq_chip_set_chip(girq, &keembay_gpio_irqchip);
girq->parent_handler = keembay_gpio_irq_handler;
girq->num_parents = KEEMBAY_GPIO_NUM_IRQ;
girq->parents = devm_kcalloc(kpc->dev, girq->num_parents,
base-commit: f33a24cc012d34f25bb9942681bd478a1757b806
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: keembay: make keembay_gpio_irqchip const
2026-11-02 21:25 [PATCH] pinctrl: keembay: make keembay_gpio_irqchip const Areeb Ul Haq Mirza
@ 2026-11-05 9:14 ` Linus Walleij
2026-11-05 9:28 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2026-11-05 9:14 UTC (permalink / raw)
To: Areeb Ul Haq Mirza; +Cc: linux-gpio, linux-kernel, Andy Shevchenko
On Tue, Nov 3, 2026 at 8:50 PM Areeb Ul Haq Mirza <auhmirza02@gmail.com> wrote:
> gpiolib warns about mutable irq_chips at probe time:
> "not an immutable chip, please consider fixing it!"
>
> Make keembay_gpio_irqchip const, flag it as IRQCHIP_IMMUTABLE, add the
> GPIOCHIP_IRQ_RESOURCE_HELPERS and register it with
> gpio_irq_chip_set_chip().
>
> The chip only implements .irq_enable() and .irq_disable(), so call
> gpiochip_enable_irq() and gpiochip_disable_irq() from those callbacks,
> following commit 35d008679a5a ("pinctrl: plgpio: Convert to immutable
> irq_chip") [1] and commit 2993d2dd8ff4 ("gpio: timberdale: Make irq_chip
> immutable") [2]. gpiochip_enable_irq() is called once a free interrupt
> source and slot have been found, so a line is only marked enabled when
> it is actually routed. gpiochip_disable_irq() is called after the line
> has been cleared from the interrupt configuration register.
>
> Link: https://lore.kernel.org/r/20230414-immutable-irqchips-2-v1-3-6b59a5186b00@linaro.org [1]
> Link: https://lore.kernel.org/r/20250509-gpio-v1-8-639377c98288@nxp.com [2]
> Signed-off-by: Areeb Ul Haq Mirza <auhmirza02@gmail.com>
Driver is marked as orphan so I just applied the patch.
Cc to Andy if he wants to pick up maintenance for this one, but I doubt
it (not x86, right?)
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: keembay: make keembay_gpio_irqchip const
2026-11-05 9:14 ` Linus Walleij
@ 2026-11-05 9:28 ` Andy Shevchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-11-05 9:28 UTC (permalink / raw)
To: Linus Walleij
Cc: Areeb Ul Haq Mirza, linux-gpio, linux-kernel, Andy Shevchenko
On Thu, Nov 05, 2026 at 10:14:07AM +0100, Linus Walleij wrote:
> On Tue, Nov 3, 2026 at 8:50 PM Areeb Ul Haq Mirza <auhmirza02@gmail.com> wrote:
>
> > gpiolib warns about mutable irq_chips at probe time:
> > "not an immutable chip, please consider fixing it!"
> >
> > Make keembay_gpio_irqchip const, flag it as IRQCHIP_IMMUTABLE, add the
> > GPIOCHIP_IRQ_RESOURCE_HELPERS and register it with
> > gpio_irq_chip_set_chip().
> >
> > The chip only implements .irq_enable() and .irq_disable(), so call
> > gpiochip_enable_irq() and gpiochip_disable_irq() from those callbacks,
> > following commit 35d008679a5a ("pinctrl: plgpio: Convert to immutable
> > irq_chip") [1] and commit 2993d2dd8ff4 ("gpio: timberdale: Make irq_chip
> > immutable") [2]. gpiochip_enable_irq() is called once a free interrupt
> > source and slot have been found, so a line is only marked enabled when
> > it is actually routed. gpiochip_disable_irq() is called after the line
> > has been cleared from the interrupt configuration register.
> >
> > Link: https://lore.kernel.org/r/20230414-immutable-irqchips-2-v1-3-6b59a5186b00@linaro.org [1]
> > Link: https://lore.kernel.org/r/20250509-gpio-v1-8-639377c98288@nxp.com [2]
> > Signed-off-by: Areeb Ul Haq Mirza <auhmirza02@gmail.com>
>
> Driver is marked as orphan so I just applied the patch.
>
> Cc to Andy if he wants to pick up maintenance for this one, but I doubt
> it (not x86, right?)
No, it's ARM. And IIRC (I may be mistaken) it was designed somewhere
close to mobileye, for some automotive related use cases. So, if ask,
try to ask mobileye people if they are willing to take it.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-05 9:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 21:25 [PATCH] pinctrl: keembay: make keembay_gpio_irqchip const Areeb Ul Haq Mirza
2026-11-05 9:14 ` Linus Walleij
2026-11-05 9:28 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®