Allow drivers to report at probe time that they cannot get all the resources
required by the device, and should be retried at a later time.
This should completely solve the problem of getting devices
initialized in the right order. Right now this is mostly handled by
mucking about with initcall ordering which is a complete hack, and
doesn't even remotely handle the case where device drivers are in
modules. This approach completely sidesteps the issues by allowing
driver registration to occur in any order, and any driver can request
to be retried after a few more other drivers get probed.
v3: - Hold off workqueue scheduling until late_initcall so that the bulk
of driver probes are complete before we start retrying deferred devices.
- Tested with simple use cases. Still needs more testing though.
Using it to get rid of the gpio early_initcall madness, or to replace
the ASoC internal probe deferral code would be ideal.
v2: - added locking so it should no longer be utterly broken in that regard
- remove device from deferred list at device_del time.
- Still completely untested with any real use case, but has been
boot tested.
TODO: - Create a separate singlethread_workqueue so that drivers can't
mess things up by calling flush_work().
- Maybe this should be wrapped with a kconfig symbol so it can
be compiled out on systems that don't care.
Signed-off-by: Grant Likely<grant.likely@xxxxxxxxxxxx>
Cc: Greg Kroah-Hartman<greg@xxxxxxxxx>
Cc: Mark Brown<broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: Arnd Bergmann<arnd@xxxxxxxx>
Cc: Dilan Lee<dilee@xxxxxxxxxx>
Cc: Manjunath GKondaiah<manjunath.gkondaiah@xxxxxxxxxx>
---
Hi Manjunath,
Here's the current state of the patch. The major think that needs to
be done is to convert it to use a separate workqueue as described in
the TODO above. It also needs some users adapted to it. One of the
gpio drivers would work; preferably one of the newer drivers that
doesn't have a lot of drivers depending on the early_initcall()
behaviour yet.
Mark Brown may also be able to suggest specific examples.
For everyone else; this is the current state of the patch. I think it[...]
is in pretty good shape other than the TODO item above. I'm turning
it over to Manjunath to polish up for merging. I would appreciate
any feedback.
g.
drivers/base/base.h | 1
drivers/base/core.c | 2 +
drivers/base/dd.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/device.h | 5 ++
4 files changed, 141 insertions(+), 1 deletions(-)