On Wed, 1 Dec 2010, Sarah Sharp wrote: > > I haven't looked carefully at this, but it seems bigger than necessary. > > Do you mean that the patch should be split into a couple of patches, or > that overall the changes seem too big? This patch is my "monster patch" > but I think I can break it up into a couple patches. I meant that overall the changes seem too big. > > For example, when deciding whether a particular hcd is USB-2 or USB-3, > > you shouldn't need to check whether it is the "main" hcd of a pair. > > Just look at the HCD_MASK part of the flags. > > You mean usb_hcd->driver->flags? I'm not sure how that helps me here. > The flags are always set to HCD_USB3 by the xHCI driver. > > What I'm trying to do with usb_hcd_is_main_hcd() is find out whether the > usb_hcd I'm dealing with is the USB 2.0 roothub under xHCI, or the USB > 3.0 roothub under xHCI. I can't do that by using HCD_MASK because the > driver pointer is always the same, and therefore the flags are always > the same. > > Perhaps the function needs a better name, but I'm not sure what. :) A simpler solution to this problem would be to store a flag in the private part of the hcd structure, next to your pointer. But there's a better approach: Add a bcdUSB field to the usb_bus structure (might as well make it host-endian since it won't get exposed outside usbcore). This information really belongs there rather than in the driver->flags field, since xhci-hcd now provides two different kinds of buses, but removing it from the driver would mean changing a lot of existing code. The new field can be initialized based on the driver's HCD_MASK bits, and xhci-hcd could adjust it as needed. Then whereever hcd.c tests hcd->driver->flags & HCD_MASK, test hcd->self.bcdUSB instead. Alan stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html