public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Florian Fainelli <florian.fainelli@telecomint.eu>,
	Ingo Molnar <mingo@elte.hu>,
	Nick Piggin <nickpiggin@yahoo.com.au>
Subject: Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support
Date: Thu, 15 Nov 2007 10:55:42 -0800	[thread overview]
Message-ID: <200711151055.43312.david-b@pacbell.net> (raw)
In-Reply-To: <20071115095123.3f595b62@dhcp-255-175.norway.atmel.com>

On Thursday 15 November 2007, Haavard Skinnemoen wrote:
> On Thu, 15 Nov 2007 00:20:33 -0800
> David Brownell <david-b@pacbell.net> wrote:
> 
> > > >   - gpio_direction_input()/gpio_direction_output() implicitly
> > > >     request the pins, if they weren't already requested.  
> > > 
> > > Eek, that's completely wrong. Allowing to access a resource _before_
> > > it is assigned and then doing the assignment implicit is a really bad
> > > idea.  
> > 
> > This is an artifact of making the GPIO interface easy to adopt,
> > by letting all the initial adopters wrap "legacy" SOC-specific
> > GPIO interfaces instead of creating a bunch of new platform code.
> 
> It's still ok for platforms that do not use gpiolib to provide NOP
> gpio_request() and gpio_free() functions if they don't care about
> tracking gpio usage.

In fact they *must* provide some implementation of those calls,
and several platforms do exactly that.  (Since the legacy GPIO
code didn't use such primitives ... nothing to wrap.)


> That doesn't mean we shouldn't require all drivers 
> to use those calls -- if they are implemented as empty inlines, it
> won't cost anything to call them.

Thing is, issuing those calls is not currently mandatory ... so
requiring use of them would be an incompatible API change, which
would require auditing (and fixing, and testing) much platform code.


> I'd rather speed up the gpio_direction_* functions a bit by removing
> the implicit gpio_request() since they may be called a lot more
> frequently and, as you pointed out, possibly from atomic context.

In fact, possibly before IRQs get set up ... some platforms start
using GPIOs very early in system setup.

- Dave

  reply	other threads:[~2007-11-15 18:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09 19:36 [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support David Brownell
2007-11-12 21:36 ` Andrew Morton
2007-11-12 22:32   ` David Brownell
2007-11-12 23:28     ` Andrew Morton
2007-11-13  1:26       ` David Brownell
2007-11-13  9:34         ` Ingo Molnar
2007-11-13 19:22           ` David Brownell
2007-11-13 12:25             ` Nick Piggin
2007-11-14  8:20               ` David Brownell
2007-11-13 21:18                 ` Nick Piggin
2007-11-15  6:28                   ` David Brownell
2007-11-14 18:51                     ` Nick Piggin
2007-11-15  8:17                       ` David Brownell
2007-11-14 19:19                         ` Nick Piggin
2007-11-14 19:21                           ` Nick Piggin
2007-11-13 20:46             ` Andrew Morton
2007-11-14  6:52               ` David Brownell
2007-11-13 19:45                 ` Nick Piggin
2007-11-14  8:37                   ` David Brownell
2007-11-13 21:08                     ` Nick Piggin
2007-11-15  6:23                       ` David Brownell
2007-11-14  9:54                     ` Haavard Skinnemoen
2007-11-15  6:50                       ` David Brownell
2007-11-15  8:43                         ` Haavard Skinnemoen
2007-11-14  9:59             ` Ingo Molnar
2007-11-14 12:14         ` Thomas Gleixner
2007-11-15  7:02           ` David Brownell
2007-11-15  7:32             ` Thomas Gleixner
2007-11-15  8:20               ` David Brownell
2007-11-15  8:51                 ` Haavard Skinnemoen
2007-11-15 18:55                   ` David Brownell [this message]
2007-11-15  7:17           ` David Brownell
2007-11-15  7:35             ` Thomas Gleixner

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=200711151055.43312.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=florian.fainelli@telecomint.eu \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=tglx@linutronix.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