Re: [PATCHv2] usb: gadget: get rid of USB_GADGET_DUALSPEED and USB_GADGET_SUPERSPEED

From: Dave Young
Date: Thu Aug 18 2011 - 09:24:13 EST


On Thu, Aug 18, 2011 at 7:57 PM, Michal Nazarewicz <mina86@xxxxxxxxxx> wrote:
> On Thu, 18 Aug 2011 05:01:11 +0200, Yang Rui Rui <ruirui.r.yang@xxxxxxxxx>
> wrote:
>>
>> I did not see the include/linux/usb/gadget.h changes, did you have another
>> patch?
>> There's ÂCONFIG_USB_GADGET_DUALSPEED ifdefs in gadget_is_dualspeed
>> function of the gadget.h
>> If so, I will get oops as before.
>
> Thanks, fixed. ÂI did âgit add -uâ while I was in drivers/usb/gadget so
> gadget.h did not get added and I've overlooked it. ÂSorry about that.
>
>> On 08/17/2011 11:33 PM, 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;
>
>> This does not works, many drivers will check the driver->speed, ie in
>> musg_gadget.c
>
> Uh? ÂNot sure what you mean here. ÂNote that driver above is not the same
> structure as driver below. Âcomposite_driver is what musb_gadget_start()
> will get.

For example I got -EINVAL in musb_gadget_start in case
composite_driver.speed = USB_SPEED_SUPER

the driver param is the composite_driver in composite.c, isn't it?
>
>> static int musb_gadget_start(struct usb_gadget *g,
>> Â Â Â Â Â Â Â Â struct usb_gadget_driver *driver)
>> {
>>     struct musb       *musb = gadget_to_musb(g);
>>     unsigned long      flags;
>>     int           retval = -EINVAL;
>>
>> Â Â Â Â if (driver->speed != USB_SPEED_HIGH)
>> Â Â Â Â Â Â Â Â goto err0;
>> [snip]
>>
>>> Â Â Â Â composite = driver;
>>> Â Â Â Â composite_gadget_bind = bind;
>
> --
> 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-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/
>



--
Regards
Yang RuiRui
--
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/