Skip to contentSkip to conversation

Patch: linux-2.5.58/drivers/base/bus.c ignored pre-existing devices

DISCUSSION Adam J. Richter 1 participant 1 message Jan 15, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 11 lines · Patrick Mochel

The extra code was an attempt at properly handling failure of ->probe(), and to make sure that an error from ->probe() (e.g. -ENOMEM) is propogated up.

The cause of the problem you're seeing is that if a device wasn't bound to a driver, -ENODEV was returned, causing it to be removed from the bus's list of devices.

To remedy this, I've changed the semantics of bus_match() to return the following:

Quoted 6 lines
* 1     if device was bound to a driver.
* 0     if it wasn't 
* <0    if drv->probe() returned an error. 

This allows the caller to know if binding happened, as well as bubble the error up.

I have't tried your patch, but, from reading it, I infer that
your patch would not work with drivers that do further matching in their probe function and return -ENODEV, which should be handled as if match() function failed. I suggest you use my patch.

Adam J. Richter     __     ______________   575 Oroville Road
[email protected]     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America

"Free Software For The Rest Of Us."