public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: avorontsov@ru.mvista.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch] gpiolib: fix oops in gpio_get_value_cansleep()
Date: Thu, 16 Oct 2008 10:06:21 -0700	[thread overview]
Message-ID: <200810161006.21276.david-b@pacbell.net> (raw)
In-Reply-To: <20081016164330.GB27938@oksana.dev.rtsoft.ru>

On Thursday 16 October 2008, Anton Vorontsov wrote:
> > -     return chip->get(chip, gpio - chip->base);
> > +     return chip->get ? chip->get(chip, gpio - chip->base) : 0;
> 
> Why don't we check the .set in the gpio_set_value? Because
> we must always call gpio_direction_output()?

Yes.  The output driver needs to be explicitly enabled,
to avoid misbehaving electic circuitry.


> It is not exactly the 
> same we work with the input direction.. is this documented anywhere?

In Documentation/gpio.txt since the very first versions.

See the section on "Spinlock-Safe GPIO access", where
special cases for reading the value of output GPIOs are
desribed.  Other aspects are mentioned in other spots.

For example, open drain signals -- as used with I2C and
other protocols -- only drive the "low" signal level,
and if code wants a "high" level it's got to verify that
nobody else is driving that shared line to low.  By
reading it back, even though it's configured as output.

- Dave



  reply	other threads:[~2008-10-16 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-16 15:45 [patch] gpiolib: fix oops in gpio_get_value_cansleep() David Brownell
2008-10-16 16:43 ` Anton Vorontsov
2008-10-16 17:06   ` David Brownell [this message]
2008-10-16 17:15     ` Anton Vorontsov
2008-10-16 23:17 ` Andrew Morton
2008-10-17  0:44   ` David Brownell
2008-10-17  0:54     ` Andrew Morton
2008-10-17  2:45       ` [stable] " Greg KH
2008-10-17  3:00         ` 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=200810161006.21276.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=avorontsov@ru.mvista.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