From: Jani Nikula <ext-jani.1.nikula@nokia.com>
To: ext David Brownell <david-b@pacbell.net>
Cc: "Ryan Mallon" <ryan@bluewatersys.com>,
"linux kernel" <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"David Brownell" <dbrownell@users.sourceforge.net>,
"gregkh@suse.de" <gregkh@suse.de>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: gpiolib and sleeping gpios
Date: Wed, 23 Jun 2010 16:22:31 +0300 (EEST) [thread overview]
Message-ID: <alpine.DEB.2.00.1006231601310.7850@wnav-qrfxgbc> (raw)
In-Reply-To: <564390.64703.qm@web180307.mail.gq1.yahoo.com>
On Wed, 23 Jun 2010, ext David Brownell wrote:
> --- On Wed, 6/23/10, Jani Nikula <ext-jani.1.nikula@nokia.com> wrote:
>
>> Hi David -
>>
>> Part of the reason why such drivers haven't been fixed
>> might be that the runtime warnings are only issued if DEBUG
>> is defined in gpiolib.c:
>
> A very good point. those cansleep() warnings
> should perhaps be issued more consistently.
>
> (Other warnings are safer to skip.)
>
> I think the normal case for the GPIO calls is
> the spinlock-safe code path, so I'd probably
> ack a patch which incurs the extra costs only
> for gpio chips that are already sleeping.
Hi -
I'd think the most important and useful warning would be about
gpio_{get,set}_value() in atomic context on a gpio chip that might sleep.
I seem to have some trouble with my foreign language parser here, so let's
move to a more natural language - see patch below. ;)
If you'd be willing to accept that, with the overhead of one conditional
statement in atomic context for non-sleepy chips, I see no reason not to
go all the way and modify whole gpiolib.c to match extra_check == 1.
BR,
Jani.
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3ca3654..33d82b7 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1527,7 +1527,7 @@ int __gpio_get_value(unsigned gpio)
struct gpio_chip *chip;
chip = gpio_to_chip(gpio);
- WARN_ON(extra_checks && chip->can_sleep);
+ might_sleep_if(chip->can_sleep);
return chip->get ? chip->get(chip, gpio - chip->base) : 0;
}
EXPORT_SYMBOL_GPL(__gpio_get_value);
@@ -1546,7 +1546,7 @@ void __gpio_set_value(unsigned gpio, int value)
struct gpio_chip *chip;
chip = gpio_to_chip(gpio);
- WARN_ON(extra_checks && chip->can_sleep);
+ might_sleep_if(chip->can_sleep);
chip->set(chip, gpio - chip->base, value);
}
EXPORT_SYMBOL_GPL(__gpio_set_value);
next prev parent reply other threads:[~2010-06-23 13:23 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 21:47 Ryan Mallon
2010-06-18 5:27 ` Uwe Kleine-König
2010-06-18 6:16 ` David Brownell
2010-06-18 22:01 ` Ryan Mallon
2010-06-19 6:21 ` David Brownell
2010-06-20 21:31 ` Ryan Mallon
2010-06-21 2:40 ` David Brownell
2010-06-21 5:09 ` Uwe Kleine-König
2010-06-23 1:59 ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleeping gpios) Ryan Mallon
2010-06-23 4:37 ` David Brownell
2010-06-23 4:58 ` Eric Miao
2010-06-23 9:51 ` David Brownell
2010-06-23 5:02 ` Ryan Mallon
2010-06-23 5:26 ` Eric Miao
2010-06-23 9:39 ` David Brownell
2010-06-23 19:12 ` Ryan Mallon
2010-06-24 4:46 ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleepinggpios) Jon Povey
2010-06-24 8:20 ` Lars-Peter Clausen
2010-06-24 8:29 ` Jani Nikula
2010-06-24 10:31 ` Lars-Peter Clausen
2010-06-24 6:41 ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleeping gpios) Uwe Kleine-König
2010-06-23 22:53 ` Jamie Lokier
2010-06-23 23:06 ` Ryan Mallon
2010-06-24 0:04 ` Jamie Lokier
2010-06-24 0:10 ` Ryan Mallon
2010-06-25 7:19 ` David Brownell
2010-06-24 4:33 ` [RFC PATCH] Rework gpio cansleep (was Re: gpiolib and sleepinggpios) Jon Povey
2010-06-29 8:29 ` gpiolib and sleeping gpios CoffBeta
2010-06-23 11:53 ` Jani Nikula
2010-06-23 12:40 ` David Brownell
2010-06-23 13:22 ` Jani Nikula [this message]
2010-06-23 13:39 ` David Brownell
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=alpine.DEB.2.00.1006231601310.7850@wnav-qrfxgbc \
--to=ext-jani.1.nikula@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=david-b@pacbell.net \
--cc=dbrownell@users.sourceforge.net \
--cc=gregkh@suse.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ryan@bluewatersys.com \
--cc=u.kleine-koenig@pengutronix.de \
/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
all inboxes | Powered by JetHome®