Thanks.
Philippe
Greg KH <greg@xxxxxxxxx> a écrit :
On Thu, Jul 12, 2007 at 06:11:32PM +0200, renardier philippe wrote:
>
> 1) I can't understand relationship between, say, pci driver and
> network driver. If my ethernet controler is hosted on a pci bus is
> this device a struct net_device or a struct pci_dev ?
Both are involved.
> If it is a pci_dev it's registered by the pci core before the core
> calls the probe callback of my driver.
Yes.
> If it is a net_device my driver must call register_netdev for the
> device.
Yes.
> What's the right way ?
You need to do both.
> (if both device structures are needed when to load the module which
> holds net_device driver code with respect to the loading of the module
> which holds pci_dev driver code ?)
Look at the zillion real pci network drivers in the kernel tree for how
to do this properly if you are confused.
> (I have focused on struct net_device as an example but the same
> question happens for other classes of devices whose controler can be
> hosted on a pci bus).
Exactly, you have to handle both. Your driver is the binding between
the hardware layer bus, and the logical layer bus (pci and networking in
your example.)
> 2) An other (unrelated) question is : why usb driver must register
> itself the devices it is bounded to ? (unlike pci driver).
There is no difference between the way usb and pci drivers register
themselves, other than the function calls and the structures involved.
The process is the same.
> It would make sens to have the same registration scheme for devices on
> both buses.
I agree, how do you think they are different? The same person wrote
them both :)
thanks,
greg k-h
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail