On Sat, Aug 25, 2007 at 05:58:16PM +0100, Adrian McMenamin wrote:
> The driver causes an oops when being initialised as a built in - because
> afaics the chain goes:
>
> driver_register -> bus_add_driver -> get_bus when, because the maple bus
> has not yet been registered with the system a NULL is returned and an
> oops is thrown (incidentally it looks like there is a bug in
> bus_add_driver as it returns a 0 and not an error in this case).
>
> So, how do I ensure the bus gets registered before the driver?
>
> (I could try using the keyboard driver as a module but the hotplugging
> issues get in the way here atm)
>
bus_register() needs to happen first, you can ensure this by using a
higher initcall level. Doing the registration from a subsys_initcall()
should be sufficient for this, you can see the varying initcall levels in
linux/init.h with comments. SuperHyway uses core_initcall() as it's
needed by some other subsystems, but you should be able to avoid that
with maple and defer it to subsys time.
|