* propagating failures down to pci_module_init()
@ 2003-01-20 15:54 Dave Jones
2003-01-20 16:33 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Dave Jones @ 2003-01-20 15:54 UTC (permalink / raw)
To: Linux Kernel
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
--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: propagating failures down to pci_module_init()
2003-01-20 15:54 propagating failures down to pci_module_init() Dave Jones
@ 2003-01-20 16:33 ` Christoph Hellwig
2003-01-20 16:52 ` Jeff Garzik
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2003-01-20 16:33 UTC (permalink / raw)
To: Dave Jones, Linux Kernel
On Mon, Jan 20, 2003 at 03:54:35PM +0000, Dave Jones wrote:
> 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 ?
Just use pci_register_driver.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: propagating failures down to pci_module_init()
2003-01-20 16:33 ` Christoph Hellwig
@ 2003-01-20 16:52 ` Jeff Garzik
2003-01-20 16:56 ` Dave Jones
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2003-01-20 16:52 UTC (permalink / raw)
To: Christoph Hellwig, Dave Jones, Linux Kernel
On Mon, Jan 20, 2003 at 04:33:21PM +0000, Christoph Hellwig wrote:
> On Mon, Jan 20, 2003 at 03:54:35PM +0000, Dave Jones wrote:
> > 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 ?
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: propagating failures down to pci_module_init()
2003-01-20 16:52 ` Jeff Garzik
@ 2003-01-20 16:56 ` Dave Jones
0 siblings, 0 replies; 4+ messages in thread
From: Dave Jones @ 2003-01-20 16:56 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Christoph Hellwig, Linux Kernel
On Mon, Jan 20, 2003 at 11:52:36AM -0500, Jeff Garzik wrote:
>
> 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.
*nod*. I cheated, and used a static global, which seems to get the
desired effect I was after.
Dave
--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-01-20 16:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-20 15:54 propagating failures down to pci_module_init() Dave Jones
2003-01-20 16:33 ` Christoph Hellwig
2003-01-20 16:52 ` Jeff Garzik
2003-01-20 16:56 ` Dave Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox