Re: [PATCH] gpiolib: Allow user-selection

From: David Brownell
Date: Sat Jul 12 2008 - 01:32:56 EST


On Thursday 03 July 2008, Greg KH wrote:
> > The scenario is that gpios sometimes get initialized very early,
> > as part of board setup before kmalloc or irqs work, so when they
> > get registered sometimes there's work left over for later.  All
> > that's needed is a predicate to test whether that class can be
> > used as a parameter to stuff like device_create_drvdata() and
> > sysfs_create_group().
>
> If you want to see if a class has any devices in it, just do a search
> for any device instead of poking into that field.  Or I can wrap that up
> in the driver core if needed.

That would require taking driver model mutexes before
tasking is working and driver_init() is called. GPIOs
are regularly used *really* early in board setup ... even
before IRQs are working.

Are driver model searches really expected to work then??

Seems simpler to me to just check "is pointer NULL",
when we know that the pointer is initialized by the
class initialization, and (because the relevant struct
is zero-initialized) null beforehand. That works more
or less any point during kernel initialization ... not
just after the first task is running. Plus it's not
as expensive. :)

- 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/