Skip to contentSkip to conversation

gpio: lynxpoint: Setup correct IRQ handlers

PATCH In review Andy Shevchenko 2 participants 5 messages Nov 18, 2019 – Nov 25, 2019 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: lynxpoint: Setup correct IRQ handlers

When commit 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()") switched default handler to be handle_bad_irq() the lp_irq_type() function remained untouched. It means that even request_irq() can't change the handler and we are not able to handle IRQs properly anymore. Fix it by setting correct handlers in the lp_irq_type() callback.

Fixes 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()")
---
 drivers/gpio/gpio-lynxpoint.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpio/gpio-lynxpoint.c +6 -0
index e9e47c0d5be7..490ce7bae25e 100644
@@ -164,6 +164,12 @@ static int lp_irq_type(struct irq_data *d, unsigned type)
 		value |= TRIG_SEL_BIT | INT_INV_BIT;
 
 	outl(value, reg);
+
+	if (type & IRQ_TYPE_EDGE_BOTH)
+		irq_set_handler_locked(d, handle_edge_irq);
+	else if (type & IRQ_TYPE_LEVEL_MASK)
+		irq_set_handler_locked(d, handle_level_irq);
+
 	spin_unlock_irqrestore(&lg->lock, flags);
 
 	return 0;
Signature · 1 line
2.24.0
#1 lore raw
Quoted 5 lines · Andy Shevchenko

When commit 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()") switched default handler to be handle_bad_irq() the lp_irq_type() function remained untouched. It means that even request_irq() can't change the handler and we are not able to handle IRQs properly anymore. Fix it by setting correct handlers in the lp_irq_type() callback.

Linus, I can send this one and MAINTAINERS update as a PR for v5.4 if it would work better for you.

P.S. I eventually found the platform to test this with GPIO IRQs (another platform I had wasn't providing GpioInt() resources and thus not possible to test).

Quoted 26 lines
Fixes 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()")
---
 drivers/gpio/gpio-lynxpoint.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpio/gpio-lynxpoint.c +6 -0
index e9e47c0d5be7..490ce7bae25e 100644
@@ -164,6 +164,12 @@ static int lp_irq_type(struct irq_data *d, unsigned type)
 		value |= TRIG_SEL_BIT | INT_INV_BIT;
 
 	outl(value, reg);
+
+	if (type & IRQ_TYPE_EDGE_BOTH)
+		irq_set_handler_locked(d, handle_edge_irq);
+	else if (type & IRQ_TYPE_LEVEL_MASK)
+		irq_set_handler_locked(d, handle_level_irq);
+
 	spin_unlock_irqrestore(&lg->lock, flags);
 
 	return 0;
Signature · 1 line
2.24.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Andy Shevchenko
Quoted 8 lines · Andy Shevchenko

When commit 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()") switched default handler to be handle_bad_irq() the lp_irq_type() function remained untouched. It means that even request_irq() can't change the handler and we are not able to handle IRQs properly anymore. Fix it by setting correct handlers in the lp_irq_type() callback.

Fixes 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()")

Patch applied!
This close to the merge window it is better if I just apply stuff I think.

Thanks for your hard work on this!

Yours,
Linus Walleij

#3 lore raw
Quoted 9 lines · Linus Walleij
Quoted 6 lines · Andy Shevchenko

When commit 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()") switched default handler to be handle_bad_irq() the lp_irq_type() function remained untouched. It means that even request_irq() can't change the handler and we are not able to handle IRQs properly anymore. Fix it by setting correct handlers in the lp_irq_type() callback.

Quoted 6 lines
Quoted 2 lines
Fixes 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()")

Patch applied!
This close to the merge window it is better if I just apply stuff I think.

Thank you! Works for me.

Quoted 2 lines

Thanks for your hard work on this!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Linus Walleij

On Mon, Nov 18, 2019 at 7:02 PM Andy Shevchenko
<[email protected]> wrote:

This close to the merge window it is better if I just apply stuff I think.

Thank you! Works for me.

Ditto for the rest (to avoid repeating this).

Signature · 2 lines
With Best Regards,
Andy Shevchenko