Re: [linux-usb-devel] [PATCH 7/9] USB usbfs: destroy submitted urbsonly on the disconnected interface

From: Alan Stern
Date: Sat Apr 17 2004 - 14:53:44 EST


On Sat, 17 Apr 2004, Duncan Sands wrote:

> On Saturday 17 April 2004 20:31, Duncan Sands wrote:
> > Alan, do you have a suggestion for how best to go from
> > a struct usb_interface to an index?

The only way is by searching the interface list. That was part of the
reason I left findintfif() alone rather than replacing it with a call to
usb_ifnum_to_if().

> (though probably usbfs shouldn't use indices at all,
> just interface numbers and struct usb_interface).

It's true that code is generally cleaner using numbers rather than
indices, and that's how I've been modifying the USB drivers when they need
it. In general I would expect an interface number to be not much larger
than the index (i.e., normally not many numbers will be skipped), so the
bitmask size should be adequate in either case. We probably don't have to
worry about trying to support devices with a single interface numbered 77
-- but if you wanted to then you'd have to use the index.

Alan Stern

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