Re: recursive call to platform_device_register deadlocks

From: David Brownell
Date: Sat Jun 18 2005 - 11:08:45 EST



> We could restructure the toplevel driver so that it does not call
> platform_device inside its probe function. An alternative would be to
> add a pointer to a vector of subdevices to platform_device and have it
> register the subdevices after it has probed the toplevel device. Do you
> have any recommendations?

Other busses have taken the former approach... the toplevel bit
being more like a bridge/hub than anything else, and the children
appearing later through some dynamic scan/hotplug. That vector
could be used to implement such a "scan", triggered sometime after
the bridge/hub driver returns from probe(), avoiding both that
driver core deadlock and recursion during probe().

I think the SPI stack will have similar issues. There it'll be
typical that configurations be static board-specific ones ... not
so dissimilar from configurations involving board-specific ASICs.
An SOC may have several SPI controllers, with their own chipselects,
and different boards will have different chips (like serial flash,
sensors, DAC/ADC, etc) on each chipselect. Unlike busses designed
for hotplug, those chips won't always self-identify; a dynamic
scan won't generally behave.

Some model that makes it easy to declare static sections of the
device tree, and which is easily applied to other bus types, would
be a good thing. Like maybe that "alternative" you sketched.

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