[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241025114914.714597-3-prabhakar.mahadev-lad.rj@bp.renesas.com>
Date: Fri, 25 Oct 2024 12:49:10 +0100
From: Prabhakar <prabhakar.csengg@...il.com>
To: Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>
Cc: linux-renesas-soc@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org,
Prabhakar <prabhakar.csengg@...il.com>,
Biju Das <biju.das.jz@...renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: [PATCH v2 2/6] pinctrl: renesas: rzg2l: Release all the virq's in free callback
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
The `free` callback in `struct irq_domain_ops` expects to free
nr_irqs interrupts starting from virq.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
---
v1->v2
- No change
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 39 ++++++++++++++-----------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 8ffb9430a134..1a09ccbfebad 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -2477,25 +2477,30 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl)
static void rzg2l_gpio_irq_domain_free(struct irq_domain *domain, unsigned int virq,
unsigned int nr_irqs)
{
+ struct rzg2l_pinctrl *pctrl;
+ irq_hw_number_t hwirq;
+ struct gpio_chip *gc;
+ unsigned long flags;
struct irq_data *d;
+ unsigned int i, j;
- d = irq_domain_get_irq_data(domain, virq);
- if (d) {
- struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
- struct rzg2l_pinctrl *pctrl = container_of(gc, struct rzg2l_pinctrl, gpio_chip);
- irq_hw_number_t hwirq = irqd_to_hwirq(d);
- unsigned long flags;
- unsigned int i;
-
- for (i = 0; i < RZG2L_TINT_MAX_INTERRUPT; i++) {
- if (pctrl->hwirq[i] == hwirq) {
- rzg2l_gpio_irq_endisable(pctrl, hwirq, false);
- rzg2l_gpio_free(gc, hwirq);
- spin_lock_irqsave(&pctrl->bitmap_lock, flags);
- bitmap_release_region(pctrl->tint_slot, i, get_order(1));
- spin_unlock_irqrestore(&pctrl->bitmap_lock, flags);
- pctrl->hwirq[i] = 0;
- break;
+ for (j = 0; j < nr_irqs; j++) {
+ d = irq_domain_get_irq_data(domain, virq + j);
+ if (d) {
+ gc = irq_data_get_irq_chip_data(d);
+ pctrl = container_of(gc, struct rzg2l_pinctrl, gpio_chip);
+ hwirq = irqd_to_hwirq(d);
+
+ for (i = 0; i < RZG2L_TINT_MAX_INTERRUPT; i++) {
+ if (pctrl->hwirq[i] == hwirq) {
+ rzg2l_gpio_irq_endisable(pctrl, hwirq, false);
+ rzg2l_gpio_free(gc, hwirq);
+ spin_lock_irqsave(&pctrl->bitmap_lock, flags);
+ bitmap_release_region(pctrl->tint_slot, i, get_order(1));
+ spin_unlock_irqrestore(&pctrl->bitmap_lock, flags);
+ pctrl->hwirq[i] = 0;
+ break;
+ }
}
}
}
--
2.43.0
Powered by blists - more mailing lists