On Wed, 17 Aug 2011, Michal Nazarewicz wrote:
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1559,12 +1559,6 @@ composite_resume(struct usb_gadget *gadget)
/*-------------------------------------------------------------------------*/
static struct usb_gadget_driver composite_driver = {
-#ifdef CONFIG_USB_GADGET_SUPERSPEED
- .speed = USB_SPEED_SUPER,
-#else
- .speed = USB_SPEED_HIGH,
-#endif
-
.unbind = composite_unbind,
.setup = composite_setup,
@@ -1609,8 +1603,7 @@ int usb_composite_probe(struct
usb_composite_driver *driver,
driver->iProduct = driver->name;
composite_driver.function = (char *) driver->name;
composite_driver.driver.name = driver->name;
- composite_driver.speed = min((u8)composite_driver.speed,
- (u8)driver->max_speed);
+ composite_driver.speed = driver->max_speed;
composite = driver;
composite_gadget_bind = bind;
On Wed, 17 Aug 2011 23:09:37 +0200, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
wrote:
I see what's going on here. Your original patch was wrong and then my
correction was wrong as well.
This line has to remain the way it was (although those (u8) typecasts
don't seem to be necessary). Above, you have to initialize
composite_driver.speed to an appropriate value, probably
USB_SPEED_SUPER.
What you didn't realize in your original patch is that
usb_composite_probe() gets called more than once. Each time it is
called, it has to adjust composite_driver.speed.
That's sneaky of composite.c... But is it desired behaviour? I cannot
came up with a situation where that's what we want. I would imagine that
usb_composite_probe() should assume the same speed for given
usb_composite_driver regardless if some other slower usb_composite_driver
was loaded.
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-----<email/xmpp: mnazarewicz@xxxxxxxxxx>-----ooO--(_)--Ooo--
--
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