public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: ljca: Fix duplicated IRQ mapping
@ 2025-10-23  7:02 Haotian Zhang
  2025-10-23  8:09 ` Bartosz Golaszewski
  2025-10-23  8:58 ` Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Haotian Zhang @ 2025-10-23  7:02 UTC (permalink / raw)
  To: Lixu Zhang, Sakari Ailus
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel,
	Haotian Zhang

The generic_handle_domain_irq() function resolves the hardware IRQ
internally. The driver performed a duplicative mapping by calling
irq_find_mapping() first, which could lead to an RCU stall.

Delete the redundant irq_find_mapping() call and pass the hardware IRQ
directly to generic_handle_domain_irq().

Fixes: c5a4b6fd31e8 ("gpio: Add support for Intel LJCA USB GPIO driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/gpio/gpio-ljca.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-ljca.c b/drivers/gpio/gpio-ljca.c
index 3b4f8830c741..cc67f3db7ecd 100644
--- a/drivers/gpio/gpio-ljca.c
+++ b/drivers/gpio/gpio-ljca.c
@@ -292,16 +292,8 @@ static void ljca_gpio_event_cb(void *context, u8 cmd, const void *evt_data,
 		return;
 
 	for (i = 0; i < packet->num; i++) {
-		irq = irq_find_mapping(ljca_gpio->gc.irq.domain,
-				       packet->item[i].index);
-		if (!irq) {
-			dev_err(ljca_gpio->gc.parent,
-				"gpio_id %u does not mapped to IRQ yet\n",
-				packet->item[i].index);
-			return;
-		}
-
-		generic_handle_domain_irq(ljca_gpio->gc.irq.domain, irq);
+		generic_handle_domain_irq(ljca_gpio->gc.irq.domain,
+					packet->item[i].index);
 		set_bit(packet->item[i].index, ljca_gpio->reenable_irqs);
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: ljca: Fix duplicated IRQ mapping
  2025-10-23  7:02 [PATCH] gpio: ljca: Fix duplicated IRQ mapping Haotian Zhang
@ 2025-10-23  8:09 ` Bartosz Golaszewski
  2025-10-23  8:48   ` Andy Shevchenko
  2025-10-23  8:58 ` Bartosz Golaszewski
  1 sibling, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2025-10-23  8:09 UTC (permalink / raw)
  To: Haotian Zhang, Andy Shevchenko
  Cc: Lixu Zhang, Sakari Ailus, Linus Walleij, linux-gpio, linux-kernel

On Thu, Oct 23, 2025 at 9:02 AM Haotian Zhang <vulab@iscas.ac.cn> wrote:
>
> The generic_handle_domain_irq() function resolves the hardware IRQ
> internally. The driver performed a duplicative mapping by calling
> irq_find_mapping() first, which could lead to an RCU stall.
>
> Delete the redundant irq_find_mapping() call and pass the hardware IRQ
> directly to generic_handle_domain_irq().
>
> Fixes: c5a4b6fd31e8 ("gpio: Add support for Intel LJCA USB GPIO driver")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---

Andy: this looks correct to me and you already sent your PR with
fixes, should I take it directly into my fixes tree for v6.18-rc3?

Bart

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: ljca: Fix duplicated IRQ mapping
  2025-10-23  8:09 ` Bartosz Golaszewski
@ 2025-10-23  8:48   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-10-23  8:48 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Haotian Zhang, Lixu Zhang, Sakari Ailus, Linus Walleij,
	linux-gpio, linux-kernel

On Thu, Oct 23, 2025 at 10:09:05AM +0200, Bartosz Golaszewski wrote:
> On Thu, Oct 23, 2025 at 9:02 AM Haotian Zhang <vulab@iscas.ac.cn> wrote:
> >
> > The generic_handle_domain_irq() function resolves the hardware IRQ
> > internally. The driver performed a duplicative mapping by calling
> > irq_find_mapping() first, which could lead to an RCU stall.
> >
> > Delete the redundant irq_find_mapping() call and pass the hardware IRQ
> > directly to generic_handle_domain_irq().
> 
> Andy: this looks correct to me and you already sent your PR with
> fixes, should I take it directly into my fixes tree for v6.18-rc3?

Yes, please. This driver is out of my scope, it should have its own maintainers
(from Intel). If not, I may rise this problem internally.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: ljca: Fix duplicated IRQ mapping
  2025-10-23  7:02 [PATCH] gpio: ljca: Fix duplicated IRQ mapping Haotian Zhang
  2025-10-23  8:09 ` Bartosz Golaszewski
@ 2025-10-23  8:58 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2025-10-23  8:58 UTC (permalink / raw)
  To: Lixu Zhang, Sakari Ailus, Haotian Zhang
  Cc: Bartosz Golaszewski, Linus Walleij, Bartosz Golaszewski,
	linux-gpio, linux-kernel

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Thu, 23 Oct 2025 15:02:30 +0800, Haotian Zhang wrote:
> The generic_handle_domain_irq() function resolves the hardware IRQ
> internally. The driver performed a duplicative mapping by calling
> irq_find_mapping() first, which could lead to an RCU stall.
> 
> Delete the redundant irq_find_mapping() call and pass the hardware IRQ
> directly to generic_handle_domain_irq().
> 
> [...]

Applied, thanks!

[1/1] gpio: ljca: Fix duplicated IRQ mapping
      https://git.kernel.org/brgl/linux/c/7d168362aedeca451ac22724f90040296dccca14

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-23  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23  7:02 [PATCH] gpio: ljca: Fix duplicated IRQ mapping Haotian Zhang
2025-10-23  8:09 ` Bartosz Golaszewski
2025-10-23  8:48   ` Andy Shevchenko
2025-10-23  8:58 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox