Re: [PATCH] gpiolib: implement dynamic base allocation

From: David Brownell
Date: Wed Mar 05 2008 - 18:41:24 EST


On Wednesday 05 March 2008, Andrew Morton wrote:
> On Tue, 4 Mar 2008 20:03:07 +0300
> Anton Vorontsov <avorontsov@xxxxxxxxxxxxx> wrote:
>
> > If gpio_chip->base is negative during registration, gpiolib requests
> > dynamic base allocation. This is useful for devices being registered
> > at run-time (in contrast to platform devices).
> >
> > Signed-off-by: Anton Vorontsov <avorontsov@xxxxxxxxxxxxx>
> > ---
> > drivers/gpio/gpiolib.c | 42 ++++++++++++++++++++++++++++++++++++------
> > 1 files changed, 36 insertions(+), 6 deletions(-)
> >
>
> This conflicts in non-trivial ways with gpio-define-gpio_is_valid.patch.
> Could you please redo and retest against 2.6.25-rc3-mm1?

And when you do that, could you make it assign GPIO numbers from
the biggest number on down, instead of from the smallest on up?

Platforms normally assign those numbers from the bottom up ... so
dynamic assignment should try to avoid reusing any numbers that may
have been explicitly assigned, but not yet registered. (Of course,
if you can come up with a cleaner solution than that, it'd be great.
Maybe platforms should also be able to mark ranges as "in use" as
they start up, or something.)

And please add a pr_debug level message reporting dynamically
assigned ranges. That way, when problems crop up it'll be that
much easier to notice what went wrong.

- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/