From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Timo Teräs" <timo.teras@iki.fi>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: rotary-encoder: use request_any_context_irq and gpio_get_value_cansleep
Date: Thu, 7 Jan 2016 10:08:16 -0800 [thread overview]
Message-ID: <20160107180816.GB12332@dtor-ws> (raw)
In-Reply-To: <1450896115-12422-1-git-send-email-timo.teras@iki.fi>
On Wed, Dec 23, 2015 at 08:41:55PM +0200, Timo Teräs wrote:
> This allows to use GPIO expanders behind I2C or SPI bus.
>
> Signed-off-by: Timo Teräs <timo.teras@iki.fi>
> ---
> drivers/input/misc/rotary_encoder.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
> index 8aee719..8bedd7b 100644
> --- a/drivers/input/misc/rotary_encoder.c
> +++ b/drivers/input/misc/rotary_encoder.c
> @@ -48,8 +48,8 @@ struct rotary_encoder {
>
> static int rotary_encoder_get_state(const struct rotary_encoder_platform_data *pdata)
> {
> - int a = !!gpio_get_value(pdata->gpio_a);
> - int b = !!gpio_get_value(pdata->gpio_b);
> + int a = !!gpio_get_value_cansleep(pdata->gpio_a);
> + int b = !!gpio_get_value_cansleep(pdata->gpio_b);
>
> a ^= pdata->inverted_a;
> b ^= pdata->inverted_b;
> @@ -335,18 +335,18 @@ static int rotary_encoder_probe(struct platform_device *pdev)
> goto exit_free_gpio_b;
> }
>
> - err = request_irq(encoder->irq_a, handler,
> - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> - DRV_NAME, encoder);
> - if (err) {
> + err = request_any_context_irq(encoder->irq_a, handler,
> + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> + DRV_NAME, encoder);
> + if (err < 0) {
This is wrong. If you are saying that you can use any context IRQ you
can get hard irq, but in rotary_encoder_get_state() (which is called
from IRQ handler) you are using sleeping gpio accessors.
I guess you need to explicitly request threaded IRQs.
Thanks.
--
Dmitry
--
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
next prev parent reply other threads:[~2016-01-07 18:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 18:41 [PATCH] Input: rotary-encoder: use request_any_context_irq and gpio_get_value_cansleep Timo Teräs
2016-01-07 18:08 ` Dmitry Torokhov [this message]
2016-01-07 20:25 ` Timo Teras
2016-01-07 20:46 ` Dmitry Torokhov
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=20160107180816.GB12332@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=timo.teras@iki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).