diff mbox

[OpenWrt-Devel,v2,6/8] generic: replace request_irq by request_threaded_irq to fix non working ledtrig-gpio

Message ID 1435837643-25569-7-git-send-email-guenther.kelleter@devolo.de
State Superseded
Headers show

Commit Message

Günther Kelleter July 2, 2015, 11:47 a.m. UTC
Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
---
 .../835-fix-irq-request-ledtrig-gpio.patch            | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 target/linux/generic/patches-3.18/835-fix-irq-request-ledtrig-gpio.patch

Comments

Felix Fietkau July 6, 2015, 10:42 a.m. UTC | #1
On 2015-07-02 13:47, Günther Kelleter wrote:
> Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
What issue does this fix?

- Felix
Günther Kelleter July 6, 2015, 12:14 p.m. UTC | #2
> -----Original Message-----

> From: Felix Fietkau [mailto:nbd@openwrt.org]

> Sent: Monday, July 06, 2015 12:43 PM

> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org

> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace request_irq by

> request_threaded_irq to fix non working ledtrig-gpio

> 

> On 2015-07-02 13:47, Günther Kelleter wrote:

> > Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>

> What issue does this fix?

> 

> - Felix


Without this change, gpio_trig_gpio_store() throws this error:
[   88.540000] leds devolo:status:dlan: request_irq failed with error -22
[   88.550000] leds devolo:error:dlan: request_irq failed with error -22


Günther
Felix Fietkau July 6, 2015, 12:59 p.m. UTC | #3
On 2015-07-06 14:14, Guenther Kelleter wrote:
> 
>> -----Original Message-----
>> From: Felix Fietkau [mailto:nbd@openwrt.org]
>> Sent: Monday, July 06, 2015 12:43 PM
>> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org
>> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace request_irq by
>> request_threaded_irq to fix non working ledtrig-gpio
>> 
>> On 2015-07-02 13:47, Günther Kelleter wrote:
>> > Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
>> What issue does this fix?
>> 
>> - Felix
> 
> Without this change, gpio_trig_gpio_store() throws this error:
> [   88.540000] leds devolo:status:dlan: request_irq failed with error -22
> [   88.550000] leds devolo:error:dlan: request_irq failed with error -22
If you rework the GPIO IRQ handler code to not require threading, you
probably won't have to change this generic code.

- Felix
Günther Kelleter July 7, 2015, 9:48 a.m. UTC | #4
> -----Original Message-----

> From: Felix Fietkau [mailto:nbd@openwrt.org]

> Sent: Monday, July 06, 2015 3:00 PM

> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org

> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace request_irq by

> request_threaded_irq to fix non working ledtrig-gpio

> 

> On 2015-07-06 14:14, Guenther Kelleter wrote:

> >

> >> -----Original Message-----

> >> From: Felix Fietkau [mailto:nbd@openwrt.org]

> >> Sent: Monday, July 06, 2015 12:43 PM

> >> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org

> >> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace

> >> request_irq by request_threaded_irq to fix non working ledtrig-gpio

> >>

> >> On 2015-07-02 13:47, Günther Kelleter wrote:

> >> > Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>

> >> What issue does this fix?

> >>

> >> - Felix

> >

> > Without this change, gpio_trig_gpio_store() throws this error:

> > [   88.540000] leds devolo:status:dlan: request_irq failed with error -22

> > [   88.550000] leds devolo:error:dlan: request_irq failed with error -22

> If you rework the GPIO IRQ handler code to not require threading, you probably

> won't have to change this generic code.

> 

> - Felix


I don't see how I could rework this. It fails because of nested interrupt handlers.
Someone already tried to solve this issue on lkml
http://lkml.iu.edu/hypermail/linux/kernel/1409.1/00930.html
but this also requires generic code changes.

Günther
Felix Fietkau July 8, 2015, 12:34 p.m. UTC | #5
On 2015-07-07 11:48, Guenther Kelleter wrote:
>> -----Original Message-----
>> From: Felix Fietkau [mailto:nbd@openwrt.org]
>> Sent: Monday, July 06, 2015 3:00 PM
>> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org
>> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace request_irq by
>> request_threaded_irq to fix non working ledtrig-gpio
>> 
>> On 2015-07-06 14:14, Guenther Kelleter wrote:
>> >
>> >> -----Original Message-----
>> >> From: Felix Fietkau [mailto:nbd@openwrt.org]
>> >> Sent: Monday, July 06, 2015 12:43 PM
>> >> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org
>> >> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace
>> >> request_irq by request_threaded_irq to fix non working ledtrig-gpio
>> >>
>> >> On 2015-07-02 13:47, Günther Kelleter wrote:
>> >> > Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
>> >> What issue does this fix?
>> >>
>> >> - Felix
>> >
>> > Without this change, gpio_trig_gpio_store() throws this error:
>> > [   88.540000] leds devolo:status:dlan: request_irq failed with error -22
>> > [   88.550000] leds devolo:error:dlan: request_irq failed with error -22
>> If you rework the GPIO IRQ handler code to not require threading, you probably
>> won't have to change this generic code.
>> 
>> - Felix
> 
> I don't see how I could rework this. It fails because of nested interrupt handlers.
> Someone already tried to solve this issue on lkml
> http://lkml.iu.edu/hypermail/linux/kernel/1409.1/00930.html
> but this also requires generic code changes.
Do you really need to use a threaded IRQ for the nested interrupt
handler for GPIO?
Can't you change the ar71xx GPIO patch to use request_irq instead and
drop the irq_set_nested_thread part?

- Felix
Günther Kelleter July 8, 2015, 1:05 p.m. UTC | #6
> -----Original Message-----

> From: Felix Fietkau [mailto:nbd@openwrt.org]

> Sent: Wednesday, July 08, 2015 2:35 PM

> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org

> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace request_irq by

> request_threaded_irq to fix non working ledtrig-gpio

> 

> On 2015-07-07 11:48, Guenther Kelleter wrote:

> >> -----Original Message-----

> >> From: Felix Fietkau [mailto:nbd@openwrt.org]

> >> Sent: Monday, July 06, 2015 3:00 PM

> >> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org

> >> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace

> >> request_irq by request_threaded_irq to fix non working ledtrig-gpio

> >>

> >> On 2015-07-06 14:14, Guenther Kelleter wrote:

> >> >

> >> >> -----Original Message-----

> >> >> From: Felix Fietkau [mailto:nbd@openwrt.org]

> >> >> Sent: Monday, July 06, 2015 12:43 PM

> >> >> To: Guenther Kelleter; openwrt-devel@lists.openwrt.org

> >> >> Subject: Re: [OpenWrt-Devel] [PATCH v2 6/8] generic: replace

> >> >> request_irq by request_threaded_irq to fix non working

> >> >> ledtrig-gpio

> >> >>

> >> >> On 2015-07-02 13:47, Günther Kelleter wrote:

> >> >> > Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>

> >> >> What issue does this fix?

> >> >>

> >> >> - Felix

> >> >

> >> > Without this change, gpio_trig_gpio_store() throws this error:

> >> > [   88.540000] leds devolo:status:dlan: request_irq failed with error -22

> >> > [   88.550000] leds devolo:error:dlan: request_irq failed with error -22

> >> If you rework the GPIO IRQ handler code to not require threading, you

> >> probably won't have to change this generic code.

> >>

> >> - Felix

> >

> > I don't see how I could rework this. It fails because of nested interrupt

> handlers.

> > Someone already tried to solve this issue on lkml

> > http://lkml.iu.edu/hypermail/linux/kernel/1409.1/00930.html

> > but this also requires generic code changes.

> Do you really need to use a threaded IRQ for the nested interrupt handler for

> GPIO?

> Can't you change the ar71xx GPIO patch to use request_irq instead and drop the

> irq_set_nested_thread part?

> 

> - Felix



Yes, I did that already and it's still working. PATCH v3 was posted yesterday.
But: Not really sure what I'm doing. All those interrupt handling functionality looks really confusing to me...
 
The patches sent yesterday don't apply anymore today. Guess I have to rebase them again.

Günther
diff mbox

Patch

diff --git a/target/linux/generic/patches-3.18/835-fix-irq-request-ledtrig-gpio.patch b/target/linux/generic/patches-3.18/835-fix-irq-request-ledtrig-gpio.patch
new file mode 100644
index 0000000..6378073
--- /dev/null
+++ b/target/linux/generic/patches-3.18/835-fix-irq-request-ledtrig-gpio.patch
@@ -0,0 +1,19 @@ 
+--- a/drivers/leds/trigger/ledtrig-gpio.c
++++ b/drivers/leds/trigger/ledtrig-gpio.c
+@@ -161,9 +161,13 @@ static ssize_t gpio_trig_gpio_store(stru
+ 		return n;
+ 	}
+ 
+-	ret = request_irq(gpio_to_irq(gpio), gpio_trig_irq,
+-			IRQF_SHARED | IRQF_TRIGGER_RISING
+-			| IRQF_TRIGGER_FALLING, "ledtrig-gpio", led);
++	ret = request_threaded_irq(
++		gpio_to_irq(gpio), 
++		NULL,
++		gpio_trig_irq,
++		IRQF_SHARED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
++		"ledtrig-gpio", 
++		led);
+ 	if (ret) {
+ 		dev_err(dev, "request_irq failed with error %d\n", ret);
+ 	} else {