All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Jamie Lokier <jamie@shareable.org>
Cc: Robin Getz <rgetz@blackfin.uclinux.org>,
	Jaya Kumar <jayakumar.lkml@gmail.com>,
	Eric Miao <eric.y.miao@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Eric Miao <eric.miao@marvell.com>,
	Haavard Skinnemoen <hskinnemoen@atmel.com>,
	Philipp Zabel <philipp.zabel@gmail.com>,
	Russell King <rmk@arm.linux.org.uk>,
	Ben Gardner <bgardner@wabtec.com>, Greg KH <greg@kroah.com>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-fbdev-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, linux-embedded@vger.kernel.org
Subject: Re: [RFC 2.6.27 1/1] gpiolib: add support for batch set of pins
Date: Mon, 29 Dec 2008 16:43:03 -0800	[thread overview]
Message-ID: <200812291643.03798.david-b@pacbell.net> (raw)
In-Reply-To: <20081230002023.GA5309@shareable.org>

On Monday 29 December 2008, Jamie Lokier wrote:
> David Brownell wrote:
> > The reason single-bit operations don't provide error paths is twofold.
> > First, they started as wrappers for can't-fail register accessors.
> > Second, it's extremely unrealisitic to expect much code to handle any
> > kind of faults in the middle of bitbanging loops ... or even just in
> > classic "set this bit and continue" configuration code.
> 
> That's interesting.  I'm not sure it's a good idea not to return an
> error code.  The caller can just ignore it if they don't care, and
> it's extremely cheap to "return 0" in GPIO drivers which can't error.

I'm not sure either; at this point I *might* consider doing
it differently -- but primarily for the case of external GPIO
chips, e.g. over I2C or SPI -- where errors are realistic.  But
it's been this way for a few years now, and changing stuff
that hasn't been observed to be a problem isn't on my list.

But as I noted:  patches for $SUBJECT don't seem to have any
reason not to report whatever faults they encounter.

Also worth remembering:  when reading a GPIO value, it's not
so easy to "ignore" a tristate (0, 1, error) return value.

 
> If I were bit-banging on GPIOs reached via some peripheral chip (such
> a GPIO-fanout chip over I2C/SPI, where that chip is itself feeding a
> secondary I2C or similar bit-banging bus), I probably would like to
> check for errors and take emergency action if the peripheral chip
> isn't responding, or just report to userspace.

If I had to do that, I'd *certainly* want to bang the hardware
designer over the head with some sort of cluebat or cluebrick.  :(


> This has actually happened on a board I worked with, where the primary
> I2C failed due to a plugged in peripheral loading it too much, and a
> secondary bit-banging bus was not then reachable.

It should now be realistic for I2C device drivers to have
fault recovery logic...

But for a long time, I2c only returned -EPERM so it was
completely hopeless trying to figure out how to "handle"
any problem beyond logging the problem and hoping someone
is watching syslog output.  That's a big part of why most
current I2C drivers have such unfriendly fault handling.

- Dave



> 
> -- Jamie
> 
> 


  reply	other threads:[~2008-12-30  0:43 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 22:52 [RFC 2.6.27 1/1] gpiolib: add support for batch set of pins Jaya Kumar
2008-11-25 22:52 ` Jaya Kumar
2008-11-26  1:20 ` Eric Miao
2008-11-26  3:27   ` Jaya Kumar
2008-11-26  4:15   ` David Brownell
2008-11-26  5:51     ` Jaya Kumar
2008-11-27 20:01       ` Sam Ravnborg
2008-11-27 23:43         ` Jaya Kumar
2008-11-28  5:47           ` Sam Ravnborg
2008-11-29 22:48         ` David Brownell
2008-11-29 23:33           ` Jaya Kumar
2008-11-29 22:54       ` David Brownell
2008-11-29 22:54         ` David Brownell
2008-11-29 23:52         ` Jaya Kumar
2008-11-30 17:55           ` David Brownell
2008-12-01  1:10             ` Jaya Kumar
2008-12-27 14:55               ` Jaya Kumar
2008-12-28 18:46                 ` Robin Getz
2008-12-28 22:00                   ` Ben Nizette
2008-12-29  0:28                     ` Jaya Kumar
2008-12-29 20:32                       ` David Brownell
2008-12-29 19:59                     ` David Brownell
2009-01-06 23:02                     ` Robin Getz
2009-01-07  1:52                       ` Ben Nizette
2008-12-29 19:56                   ` David Brownell
2008-12-30  0:20                     ` Jamie Lokier
2008-12-30  0:43                       ` David Brownell [this message]
2008-12-31  4:55                     ` Robin Getz
2008-12-31  4:58                       ` Jaya Kumar
2008-12-31  5:02                         ` Jaya Kumar
2008-12-31 17:38                         ` Robin Getz
2008-12-31 18:05                           ` Jaya Kumar
2009-01-06 22:41                             ` Robin Getz
2009-01-10  7:37                               ` Jaya Kumar
2008-12-29 19:32                 ` David Brownell
2008-12-30 15:45                   ` Jaya Kumar
2008-12-29 19:06               ` David Brownell
2008-11-26  9:09 ` Paulius Zaleckas
2008-11-26  9:09   ` Paulius Zaleckas
2008-11-26  9:18   ` Jaya Kumar
2008-11-26 10:08     ` [Linux-fbdev-devel] " Geert Uytterhoeven
2008-11-26 10:25       ` Jaya Kumar
2008-11-26 12:08         ` Geert Uytterhoeven
2008-11-29 22:47     ` David Brownell
2008-11-29 23:04       ` Jaya Kumar
2008-11-30  3:27         ` 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=200812291643.03798.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=bgardner@wabtec.com \
    --cc=eric.miao@marvell.com \
    --cc=eric.y.miao@gmail.com \
    --cc=greg@kroah.com \
    --cc=hskinnemoen@atmel.com \
    --cc=jamie@shareable.org \
    --cc=jayakumar.lkml@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.zabel@gmail.com \
    --cc=rgetz@blackfin.uclinux.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=sam@ravnborg.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 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.