driver_attach question
Hi,
Should driver_attach( ) return an error value?
I have disabled a device in the system bios, The driver fails to report -ENODEV.
This is for 2.6.11.1 kernel
When I dig through the PCI subsystem and driver_attach code, I find that :
pci_register_driver is returing zero(no error) even when the device is not present in the system. But when I check driver_attach( ), I get -ENODEV for driver_probe_device(). which is correct. But driver_attach( ) does not return this error value. driver attach( ) is called in bus_add_driver( ) and bus_add_driver just returns error=0
Hence I get error=0 in pci_register_driver.
Am I missing something in the flow?
int pci_register_driver( )
{
.....
.....
error = driver_register(&drv->driver);
return error;
}
int driver_register(struct device_driver * drv) {
.....
return bus_add_driver(drv);
}
int bus_add_driver(struct device_driver * drv) {
.....driver_attach(drv);
...
return error;
}
void driver_attach(struct device_driver * drv) {
....
error = driver_probe_device(drv, dev);
....
}
with regards,
Anil
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 19 lines · Anil kumar
Hi,
Should
driver_attach( )return an error value?I have disabled a device in the system bios, The driver fails to report
-ENODEV.
This is for 2.6.11.1 kernel
When I dig through the PCI subsystem anddriver_attachcode, I find that :
pci_register_driveris returing zero(no error) even when the device is not present in the system. But when I checkdriver_attach( ), I get-ENODEVfordriver_probe_device(). which is correct. Butdriver_attach( )does not return this error value. driverattach( )is called inbus_add_driver( )andbus_add_driverjust returns error=0
Hence I get error=0 inpci_register_driver.
Quoted 1 line
Am I missing something in the flow?
The basic strategy is to leave the driver loaded so that later, if the a device is hotplugged or the user adds a dynamic id to an existing device, it will be available. In other words, even if the registration of a driver does not result in device detection, the operation can still considered successful.
Does this answer your question?
Thanks,
Adam