Re: [linux-usb-devel] [RFC] USB driver conversion to use "struct device_driver"

Greg KH (greg@kroah.com)
Sat, 10 Aug 2002 08:40:18 -0700


On Sat, Aug 10, 2002 at 11:57:28AM +0200, Oliver Neukum wrote:
> Am Samstag, 10. August 2002 02:10 schrieb Greg KH:
> > Hi all,
>
> > The USB subsystem only binds drivers to USB "interfaces". A USB device
> > may have many "interfaces", so a single device may have many drivers
> > attached to it, handling different portions of it (think of a USB
> > speaker, which has a audio driver for the audio stream, and a HID driver
> > for the speaker buttons.) Because of this I had to create a "empty"
> > device driver that I attach to the USB device structure. This ensures
> > it shows up properly in the driverfs tree, and that no USB drivers try
> > to bind to it.
>
> Hi,
>
> the probe/disconnect changes are an improvement.
> But what do we call a device? IMHO the device in
> terms of driverfs is the interface, thus the usb_device
> should be seen as a bus, which interfaces are attached to.

Hm, I don't really understand your question, but I'll try to explain
how I did this.

Both struct usb_device and struct usb_interface now have a struct
device. This is because _both_ things need to show up in the driverfs
tree. I tried only making interfaces be devices (which is more of what
the USB core code things of as devices), but the tree just didn't make
much sense. Also, a USB device contains such things as the control
pipe, and the usb descriptors and strings. So it is useful to show the
device, as that's where you get the device name and serial number from :)

Does that help?

Try looking at the usb driverfs implementation as it is in 2.5.30, both
the interfaces and the main device show up in the tree, I didn't change
this. All this patch does is start to use "struct device_driver", and
bind the drivers to the interfaces, _which_ is what the USB core has
always done (no change in functionality here.) What this allows us to
do is remove (eventually) the USB list of devices, and remove some other
device list logic, as well as clean up the probe/disconnect interface.

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/