# Re: \[PATCH\] input: replace request\_irq by request\_any\_context\_irq in keyboard GPIO driver

- From: Rabin Vincent \<hidden\>
- Date: 2011-01-20 09:24:06 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2011/01/8915894
- Thread: https://ratatoskr.run/linux-input/2011/01/8915845/t.md

```text
On Thu, Jan 20, 2011 at 08:53:48 +0100, Dmitry Torokhov wrote:
> On Wed, Jan 12, 2011 at 10:41:32AM +0100, Philippe Langlais wrote:
> > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> > index 6069abe..eb30063 100644
> > --- a/drivers/input/keyboard/gpio_keys.c
> > +++ b/drivers/input/keyboard/gpio_keys.c
> > @@ -322,7 +322,7 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata)
> >  	struct gpio_keys_button *button = bdata->button;
> >  	struct input_dev *input = bdata->input;
> >  	unsigned int type = button->type ?: EV_KEY;
> > -	int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low;
> > +	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;
> >  
> >  	input_event(input, type, button->code, !!state);
> >  	input_sync(input);
> > @@ -410,8 +410,8 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
> >  	if (!button->can_disable)
> >  		irqflags |= IRQF_SHARED;
> >  
> > -	error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata);
> > -	if (error) {
> > +	error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata);
> > +	if (error < 0) {
> 
> No, this it not correct. request_any_context_irq() means that you could
> either get a hardirq or a treaded one. However above you are changing to
> gpio_get_value_cansleep() which indicates that you can sleep.

Note that gpio_get_value_cansleep() is not being called from the interrupt
handler (threaded or not), but from a work queue.

Rabin

```
