diff mbox series

[v1] gpio: lynxpoint: Setup correct IRQ handlers

Message ID 20191118180251.31439-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1] gpio: lynxpoint: Setup correct IRQ handlers | expand

Commit Message

Andy Shevchenko Nov. 18, 2019, 6:02 p.m. UTC
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()")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-lynxpoint.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Andy Shevchenko Nov. 18, 2019, 6:22 p.m. UTC | #1
On Mon, Nov 18, 2019 at 08:02:51PM +0200, Andy Shevchenko wrote:
> 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).

> Fixes: 75e99bf5ed8f ("gpio: lynxpoint: set default handler to be handle_bad_irq()")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-lynxpoint.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
> index e9e47c0d5be7..490ce7bae25e 100644
> --- a/drivers/gpio/gpio-lynxpoint.c
> +++ b/drivers/gpio/gpio-lynxpoint.c
> @@ -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;
> -- 
> 2.24.0
>
Linus Walleij Nov. 21, 2019, 2:02 p.m. UTC | #2
On Mon, Nov 18, 2019 at 7:02 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> 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()")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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
Andy Shevchenko Nov. 25, 2019, 11:53 a.m. UTC | #3
On Thu, Nov 21, 2019 at 03:02:44PM +0100, Linus Walleij wrote:
> On Mon, Nov 18, 2019 at 7:02 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > 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()")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Patch applied!
> This close to the merge window it is better if I just apply stuff
> I think.

Thank you! Works for me.

> 
> Thanks for your hard work on this!
Andy Shevchenko Nov. 25, 2019, 11:54 a.m. UTC | #4
On Mon, Nov 25, 2019 at 01:53:27PM +0200, Andy Shevchenko wrote:
> On Thu, Nov 21, 2019 at 03:02:44PM +0100, Linus Walleij wrote:
> > On Mon, Nov 18, 2019 at 7:02 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> 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).
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index e9e47c0d5be7..490ce7bae25e 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -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;