Skip to content

Commit

Permalink
Input: rotary-encoder - defer calls gpio_to_irq()
Browse files Browse the repository at this point in the history
Don't call gpio_to_irq() on GPIOs before gpio_request() succeeded on
them. This avoids Ooopses with incorrect DT bindings.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Daniel Mack authored and Dmitry Torokhov committed Aug 22, 2012
1 parent a2f2524 commit a78769b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/input/misc/rotary_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev)

encoder->input = input;
encoder->pdata = pdata;
encoder->irq_a = gpio_to_irq(pdata->gpio_a);
encoder->irq_b = gpio_to_irq(pdata->gpio_b);

/* create and register the input driver */
input->name = pdev->name;
Expand Down Expand Up @@ -215,6 +213,9 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev)
goto exit_free_gpio_a;
}

encoder->irq_a = gpio_to_irq(pdata->gpio_a);
encoder->irq_b = gpio_to_irq(pdata->gpio_b);

/* request the IRQs */
if (pdata->half_period) {
handler = &rotary_encoder_half_period_irq;
Expand Down

0 comments on commit a78769b

Please sign in to comment.