usbatm : modprobe & rmmod

matthieu castet castet.matthieu at free.fr
Tue Jan 25 06:17:20 EST 2005


Hi,

Duncan Sands wrote:
> Hi Matthieu,
> 
> 
>>>>I have still one complain : why driver info is still used ?
>>>>why not doing like pci-ide and give when registering struct 
>>>>usbatm_driver and usb_interface ?
>>>
>>>
>>>I don't know anything about pci-ide.  Where should I look in the kernel tree?
>>>
>>
>>drivers/ide/setup-pci.c for the core
>>drivers/ide/pci/ for drivers
> 
> 
> I'm confused: as far as I can see, the pci-ide methods are the same as
> the basic pci methods, and the same struct pci_driver is used for both.
> Since the usbatm and usb methods are different, I don't see the relevance
> of this example.

Let's take an example : via82cxxx.c
yes the driver register with the same struct pci_driver, but in the 
probe, it register with

ide_setup_pci_device(dev, &via82cxxx_chipset);

static ide_pci_device_t via82cxxx_chipset __devinitdata = {
         .name           = "VP_IDE",
         .init_chipset   = init_chipset_via82cxxx,
         .init_hwif      = init_hwif_via82cxxx,
         .channels       = 2,
         .autodma        = NOAUTODMA,
         .enablebits     = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
         .bootable       = ON_BOARD,
};

here struct pci_driver and ide_pci_device_t are different struct like 
usbatm and usb...

this method solve some problem I explain in another mail.

So let's take an example for usb and usb_atm

static struct usb_driver speedtch_usb_driver = {
         .owner          = THIS_MODULE,
         .name           = speedtch_driver_name,
         .probe          = speedtch_usb_probe,
         .disconnect     = speedtch_usb_disconnect,
         .ioctl          = speedtch_usb_ioctl,
         .id_table       = speedtch_usb_ids,
};

static struct usb_driver speedtch_usbatm_driver = {
.bind = speed_bind,
....
};
speedtch_usb_probe(...)
{
usbatm_register(intf, &speedtch_usbatm_driver);
}

> 
> By the way, if you are suggesting that minidriver modules should register
> a struct usb_driver with the USB core, and provide their methods via the
> driver_info field in struct usb_device_id, that is certainly possible and
> is how it was done a few days ago.
Yes but it was done in the monolitic driver, not in subdriver

Look at piix.c for exmaple :

static struct pci_driver driver = {
         .name           = "PIIX_IDE",
         .id_table       = piix_pci_tbl,
         .probe          = piix_init_one,
};

static int __devinit piix_init_one(struct pci_dev *dev, const struct 
pci_device_id *id)
{
         ide_pci_device_t *d = &piix_pci_info[id->driver_data];

         d->init_setup(dev, d);
         return 0;
}


Matthieu



More information about the Usbatm mailing list