Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Thomas Gleixner <tglx@...>
Cc: Andrew Morton <akpm@...>, Linux Kernel list <linux-kernel@...>, Florian Fainelli <florian.fainelli@...>, Haavard Skinnemoen <hskinnemoen@...>, Ingo Molnar <mingo@...>, Nick Piggin <nickpiggin@...>
Date: Thursday, November 15, 2007 - 3:02 am

On Wednesday 14 November 2007, Thomas Gleixner wrote:

As Haavard had noted.  The "requested" flag is actually serving
as a longterm bit-level lock, which -- assuming well-behaved
callers, and no debug instrumentation -- obviates any need to
grab a spinlock in hot paths.



That's what the gpio_request() call does, although it's using
something isomorphic to a refcount, not an actual refcount.

The key observation here is that we already *have* a bit which
is serving as a per-gpio lock.  It's just never been viewed as
a lock before.  :)



No, we still need to use a spinlock to protect table changes.
The reason for that is briefly:

  - gpio_request()/gpio_free() have so far been optional.  Most
    platforms implement them as NOPs, not all drivers use them.
    (Having gpiolib in place should help change that ...)

  - gpio_direction_input()/gpio_direction_output() implicitly
    request the pins, if they weren't already requested.

  - Those input/output direction-setting calls may be called
    in IRQ contexts, which means (on non-RT kernels) no mutex.


So we're actually in good shape; just take out a bit of code
(or turn it into debugging instrumentation) and I don't think
anyone will complain about the locking any more.

- Dave

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Fri Nov 9, 3:36 pm)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Thomas Gleixner, (Wed Nov 14, 8:14 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Thomas Gleixner, (Thu Nov 15, 3:35 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, David Brownell, (Thu Nov 15, 3:02 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Thomas Gleixner, (Thu Nov 15, 3:32 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Haavard Skinnemoen, (Thu Nov 15, 4:51 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Haavard Skinnemoen, (Wed Nov 14, 5:54 am)
Re: [patch 2.6.24-rc2 1/3] generic gpio -- gpio_chip support, Haavard Skinnemoen, (Thu Nov 15, 4:43 am)