From: David Brownell <david-b@pacbell.net>
To: "Arve Hjønnevåg" <arve@android.com>
Cc: Ferenc Wagner <wferi@niif.hu>, linux-input@vger.kernel.org
Subject: Re: gpio_get_value in atomic context (was: make gpio-keys use IRQF_SHARED)
Date: Fri, 27 Nov 2009 17:08:01 -0800 [thread overview]
Message-ID: <200911271708.01727.david-b@pacbell.net> (raw)
In-Reply-To: <d6200be20910140440t2357cb4fx5f7aeba0d4b15943@mail.gmail.com>
On Wednesday 14 October 2009, Arve Hjønnevåg wrote:
> 2009/10/14 Ferenc Wagner <wferi@niif.hu>:
> > Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
> >
> >> On Mon, Oct 12, 2009 at 07:09:50PM +0200, Ferenc Wagner wrote:
> >>
> >>> The gpio_get_value function may sleep, so it should not be
> >>> called in a timer function.
> >>>
> >>> So is drivers/staging/dream/gpio_input.c in error, too?
> >>
> >> I guess so. Initially gpio method did not sleep but that has
> >> changed.
> >
> > Let's make Arve aware of this then (even though it may not affect
> > Android in practice).
>
> If gpio_get_value may sleep, then what is gpio_get_value_cansleep for?
To tell if this is one of the GPIOs for which it may sleep.
Whether the GPIO is atomic vs cansleep is an attribute of the
GPIO itself, not the routine it's called with.
> The gpio documentation claims gpio_get_value and gpio_set_value are
> safe to use from interrupt context, but a call to gpio_cansleep is
> probably needed in probe.
They're safe to use there ... if that GPIO is safe. Yes, make sure
you know the answer before you call gpio_get_value() instead of
the always-safe gpio_get_value_cansleep().
> The matrix driver also need to change the direction of the gpio from
> the timer, so it would be useful to have a standard way to check if
> this is allowed as well.
If gpio_{set,get}_value() can sleep, so can gpio_direction_*().
- Dave
--
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:[~2009-11-28 1:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 15:03 [PATCH] input: make gpio-keys use IRQF_SHARED Dmitry Eremin-Solenikov
2009-09-16 16:28 ` Dmitry Torokhov
2009-09-16 18:41 ` Dmitry Eremin-Solenikov
2009-09-18 11:44 ` Dmitry Eremin-Solenikov
2009-09-22 16:42 ` Dmitry Torokhov
2009-09-22 18:50 ` Ferenc Wagner
2009-09-22 15:14 ` Ferenc Wagner
2009-09-22 16:41 ` Dmitry Torokhov
2009-09-22 19:06 ` Ferenc Wagner
2009-09-28 17:03 ` Dmitry Torokhov
2009-10-01 14:02 ` Ferenc Wagner
2009-10-12 17:09 ` Ferenc Wagner
2009-10-14 8:04 ` Dmitry Torokhov
2009-10-14 11:03 ` gpio_get_value in atomic context (was: make gpio-keys use IRQF_SHARED) Ferenc Wagner
2009-10-14 11:40 ` Arve Hjønnevåg
2009-11-28 1:08 ` David Brownell [this message]
2009-11-30 15:35 ` gpio_get_value in atomic context Ferenc Wagner
2009-12-09 13:33 ` Ferenc Wagner
2009-10-14 11:25 ` [PATCH] input: make gpio-keys use IRQF_SHARED Ferenc Wagner
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=200911271708.01727.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=arve@android.com \
--cc=linux-input@vger.kernel.org \
--cc=wferi@niif.hu \
/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.