]> err.no Git - linux-2.6/commit
gpiolib: dynamic gpio number allocation
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Mon, 28 Apr 2008 09:14:46 +0000 (02:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:34 +0000 (08:58 -0700)
commit8d0aab2f16c4fa170f32e7a74a52cd0122bbafef
treec9e559489af8f2cbcceda8a323e4ac496114765a
parente6de1808f8ebfeb7e49f3c5a30cb8f2032beb287
gpiolib: dynamic gpio number allocation

If gpio_chip->base is negative during registration, gpiolib performs dynamic
base allocation.  This is useful for devices that aren't always present, such
as GPIOs on hotplugged devices rather than mainboards.  (This behavior was
previously specified but not implemented.)

To avoid using any numbers that may have been explicitly assigned but not yet
registered, this dynamic allocation assigns GPIO numbers from the biggest
number on down, instead of from the smallest on up.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpio/gpiolib.c