[OpenWrt-Devel] [PATCH] kernel: gpio-button-hotplug: Add missing ONESHOT flag to threaded IRQ request
Petr Štetiar
ynezz at true.cz
Thu Mar 3 11:35:48 EST 2016
Without the IRQF_ONESHOT flag in devm_request_threaded_irq() call I get
following error:
genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 56
gpio-keys gpio-keys: failed to request irq:56 for gpio:20
From kernel/irq/manage.c:
The interrupt was requested with handler = NULL, so we use the default
primary handler for it. But it does not have the oneshot flag set. In
combination with level interrupts this is deadly, because the default
primary handler just wakes the thread, then the irq lines is reenabled,
but the device still has the level irq asserted. Rinse and repeat....
While this works for edge type interrupts, we play it safe and reject
unconditionally because we can't say for sure which type this interrupt
really has. The type flags are unreliable as the underlying chip
implementation can override them.
Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
package/kernel/gpio-button-hotplug/Makefile | 2 +-
package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package/kernel/gpio-button-hotplug/Makefile b/package/kernel/gpio-button-hotplug/Makefile
index c2fdaec..b9a481a 100644
--- a/package/kernel/gpio-button-hotplug/Makefile
+++ b/package/kernel/gpio-button-hotplug/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=gpio-button-hotplug
-PKG_RELEASE:=1
+PKG_RELEASE:=2
include $(INCLUDE_DIR)/package.mk
diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index 6d1a197..0ebe6c5 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -563,7 +563,7 @@ static int gpio_keys_probe(struct platform_device *pdev)
}
ret = devm_request_threaded_irq(&pdev->dev, button->irq, NULL, button_handle_irq,
- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
dev_name(&pdev->dev), bdata);
if (ret < 0)
dev_err(&pdev->dev, "failed to request irq:%d for gpio:%d\n", button->irq, button->gpio);
--
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list