linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] gpiolib: Implement devm_gpio_request_one()
Date: Sat, 7 Apr 2012 10:16:36 +0100	[thread overview]
Message-ID: <20120407091636.GD3099@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20120407090018.GC3099@opensource.wolfsonmicro.com>

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

On Sat, Apr 07, 2012 at 10:00:18AM +0100, Mark Brown wrote:
> On Fri, Apr 06, 2012 at 07:25:12PM -0700, Grant Likely wrote:

> > Actually, I looked at it again, and the _one version behaves subtly
> > different from the non-_one version.  That may be irrelevant though.

> It always does a direction set, yes.  This will make a difference if the
> direction call either fails or blocks future reconfigurations, what was
> puzzling me was if this was an issue or not and like I say I decided to
> assume it was and stick with the same pattern.

Just after sending this (isn't that always the way?) I realised there is
one important case where it makes a difference: if the code does this:

	gpio_request(foo, "bar");
	gpio_direction_output(foo, 1);

then if the GPIO was already driving out high we will maintain steady
state.  If, however, we were to do:

	gpio_request(foo, "bar");
	gpio_direction_input();
	gpio_direction_output(foo, 1);

where the first two calls are the natural result of implementing
gpio_request() in terms of gpio_request_one() then the GPIO would glitch
high Z during the process which might have unfortunate consequences for
whatever the GPIO is controlling.

I think instead of redoing the implementation we need start a campaign
to convert gpio_request() users to gpio_request_one() - coccinelle can
probably take a large chunk of the work but it'll need some manual help
I expect.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-04-07  9:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04 15:14 [PATCH 1/2] gpiolib: Add !CONFIG_GPIOLIB definitions of devm_ functions Mark Brown
2012-04-04 15:14 ` [PATCH 2/2] gpiolib: Implement devm_gpio_request_one() Mark Brown
2012-04-06  4:48   ` Grant Likely
2012-04-06 14:49     ` Mark Brown
2012-04-07  2:25       ` Grant Likely
2012-04-07  9:00         ` Mark Brown
2012-04-07  9:16           ` Mark Brown [this message]
2012-04-06  4:40 ` [PATCH 1/2] gpiolib: Add !CONFIG_GPIOLIB definitions of devm_ functions Grant Likely
  -- strict thread matches above, loose matches on Subject: below --
2012-05-02 11:46 Mark Brown
2012-05-02 11:46 ` [PATCH 2/2] gpiolib: Implement devm_gpio_request_one() Mark Brown
2012-05-12 19:05   ` Mark Brown
2012-05-18  0:10     ` Grant Likely
2012-05-12 23:19   ` Linus Walleij

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=20120407091636.GD3099@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@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 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).