propagating failures down to pci_module_init()
I've got a wierd situation with a certain chipset for agpgart. There are a few cases where I want to be able to use the existing pci_driver api to detect the right PCI device, and call the relevant .probe routine. No problem there.
The problem is that in these cases, I want to be able to read a certain register in that device, and if a bit is 0, bail out of the .probe function with -ENODEV, and make the loading of the module fail.
The problem is that the ENODEV in my .probe routine doesn't propagate back down as far as pci_module_init().
Ideas ?
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 10 lines · Dave Jones
I've got a wierd situation with a certain chipset for agpgart. There are a few cases where I want to be able to use the existing
pci_driverapi to detect the right PCI device, and call the relevant .probe routine. No problem there.The problem is that in these cases, I want to be able to read a certain register in that device, and if a bit is 0, bail out of the .probe function with
-ENODEV, and make the loading of the module fail.
Quoted 4 lines
The problem is that the ENODEV in my .probe routine doesn't propagate back down as far as
pci_module_init().Ideas ?
Just use pci_register_driver.
Quoted 11 lines · Christoph Hellwig
Quoted 10 lines · Dave Jones
I've got a wierd situation with a certain chipset for agpgart. There are a few cases where I want to be able to use the existing
pci_driverapi to detect the right PCI device, and call the relevant .probe routine. No problem there.The problem is that in these cases, I want to be able to read a certain register in that device, and if a bit is 0, bail out of the .probe function with
-ENODEV, and make the loading of the module fail.
Quoted 6 lines
Quoted 4 lines
The problem is that the ENODEV in my .probe routine doesn't propagate back down as far as
pci_module_init().Ideas ?
Just use
pci_register_driver.
Nope. Look at pci_module_init code. It propagates pci_register_driver return value.
The _real_ problem is that ->probe return value is not propagated back to pci_register_driver return value. The reason for this is that you may call ->probe many times, and nobody has written the code to collate the error returns.
Since one can only sanely return an error code when there was _one_ device and it failed, you are rather limited in error propagation.
Jeff
Quoted 11 lines · Jeff Garzik
Nope. Look at
pci_module_initcode. It propagatespci_register_driverreturn value.The _real_ problem is that ->probe return value is not propagated back to
pci_register_driverreturn value. The reason for this is that you may call ->probe many times, and nobody has written the code to collate the error returns.Since one can only sanely return an error code when there was _one_ device and it failed, you are rather limited in error propagation.
*nod*. I cheated, and used a static global, which seems to get the desired effect I was after.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs