From: Daniel Mack <zonque@gmail.com>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
"jhovold@gmail.com" <jhovold@gmail.com>
Subject: Re: [PATCH 2/2] input: rotary-encoder: defer calls gpio_to_irq()
Date: Wed, 25 Jul 2012 09:43:03 +0200 [thread overview]
Message-ID: <500FA387.5010504@gmail.com> (raw)
In-Reply-To: <ADE657CA350FB648AAC2C43247A983F00206AABE13B5@AUSP01VMBX24.collaborationhost.net>
On 24.07.2012 21:45, H Hartley Sweeten wrote:
> On Tuesday, July 24, 2012 10:38 AM, 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 350cbd1..474b04f 100644
>> --- a/drivers/input/misc/rotary_encoder.c
>> +++ b/drivers/input/misc/rotary_encoder.c
>> @@ -223,8 +223,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;
>> @@ -275,6 +273,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;
>
> Daniel,
>
> You might want to put this patch first before adding the DT binding
> stuff.
>
> You also might consider using gpio_request_one() or even the
> devm_* version, instead of doing the gpio_request() followed
> by the gpio_direction_input().
>
> Actually, if you convert the probe to use the managed resource
> devm_* stuff it would really cleanup the error path and the remove.
Yes, you're right. Thanks for the hint. New version coming up. Does your
Reviewed-by: still apply?
Daniel
next prev parent reply other threads:[~2012-07-25 7:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 17:38 [PATCH 1/2] input: rotary-encoder: add DT bindings Daniel Mack
2012-07-24 17:38 ` [PATCH 2/2] input: rotary-encoder: defer calls gpio_to_irq() Daniel Mack
2012-07-24 19:45 ` H Hartley Sweeten
2012-07-25 7:43 ` Daniel Mack [this message]
2012-07-25 16:38 ` H Hartley Sweeten
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=500FA387.5010504@gmail.com \
--to=zonque@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hartleys@visionengravers.com \
--cc=jhovold@gmail.com \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.