diff mbox

[v3,1/3] input: rotary-encoder: defer calls gpio_to_irq()

Message ID 1343240714-11399-1-git-send-email-zonque@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Mack July 25, 2012, 6:25 p.m. UTC
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>
---
 drivers/input/misc/rotary_encoder.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Daniel Mack July 30, 2012, 9:39 a.m. UTC | #1
Hi Dmitry and Hartley,

does that new approach look better to you?


Daniel

On 25.07.2012 20:25, Daniel Mack wrote:
> 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>
> ---
>  drivers/input/misc/rotary_encoder.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
> index f07f784..00a7bda 100644
> --- a/drivers/input/misc/rotary_encoder.c
> +++ b/drivers/input/misc/rotary_encoder.c
> @@ -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;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
index f07f784..00a7bda 100644
--- a/drivers/input/misc/rotary_encoder.c
+++ b/drivers/input/misc/rotary_encoder.c
@@ -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;