Input: rotary-encoder - defer calls gpio_to_irq()

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>
This commit is contained in:
Daniel Mack 2012-07-31 22:08:47 -07:00 committed by Dmitry Torokhov
parent a2f2524526
commit a78769b80d
1 changed files with 3 additions and 2 deletions

View File

@ -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;
@ -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;