lkml.org 
[lkml]   [2020]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] gpio: siox: indicate exclusive support of threaded IRQs
Date
Generic GPIO consumers like gpio-keys use request_any_context_irq()
to request a threaded handler if irq_settings_is_nested_thread() ==
true or a hardirq handler otherwise.

Drivers using handle_nested_irq() must be sure that the nested
IRQs were requested with threaded handlers, because the IRQ
is handled by calling action->thread_fn().

The gpio-siox driver dispatches IRQs via handle_nested_irq,
but has irq_settings_is_nested_thread() == false.

Set gpio_irq_chip::threaded to remedy this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
I am writing a driver similar to gpio-siox and I ran into a null pointer
dereference, because ->threaded wasn't set. I didn't test this on actual
SIOX hardware.

This patch doesn't fix the case were are driver explicitly calls
request_irq and is combined with a driver that does handle_nested_irq.

Is there a flag, such drivers should additionally set or should we
check action->thread_fn before calling it inside handle_nested_irq?
---
drivers/gpio/gpio-siox.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-siox.c b/drivers/gpio/gpio-siox.c
index 26e1fe092304..f8c5e9fc4bac 100644
--- a/drivers/gpio/gpio-siox.c
+++ b/drivers/gpio/gpio-siox.c
@@ -245,6 +245,7 @@ static int gpio_siox_probe(struct siox_device *sdevice)
girq->chip = &ddata->ichip;
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_level_irq;
+ girq->threaded = true;

ret = devm_gpiochip_add_data(dev, &ddata->gchip, NULL);
if (ret)
--
2.28.0
\
 
 \ /
  Last update: 2020-08-04 11:18    [W:0.100 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site