Re: [PATCH] usb: gadget: don't create new string_container if already exist

From: Felipe Balbi
Date: Wed Nov 05 2014 - 14:07:58 EST


On Tue, Nov 04, 2014 at 03:05:57AM -0800, Neil Zhang wrote:
>
> > -----Original Message-----
> > From: Andrzej Pietrasiewicz [mailto:andrzej.p@xxxxxxxxxxx]
> > Sent: 2014å10æ28æ 21:10
> > To: Neil Zhang; linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> > Cc: balbi@xxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx
> > Subject: Re: [PATCH] usb: gadget: don't create new string_container if already
> > exist
> >
> > Hi,
> >
> > W dniu 28.10.2014 o 12:33, Neil Zhang pisze:
> > > Don't create new usb_gadget_string_container if the current strings
> > > are already exist in the usb_composite_dev.
> > > Otherwise the ids_tab will overflow soon if we bind / unbind usb
> > > functions frequently like android does.
> >
> > The problem you are describing does not exist in mainline kernel, where
> > functions are always unbound as part of the whole gadget's unbind - regardless
> > of whether it is a legacy gadget or configfs-composed gadget. When the whole
> > gadget is unbound, composite_dev_cleanup() is called which zeroes cdev-
> > >next_string_id and frees all gadget strings containers.
> >
>
> Yes, you are right that the current mainline won't suffer this issue.
> But it will be needed if we want to implement similar features like android do.

once you have the features, then implement it. I don't want any unused
code here, specially since it won't be tested by anything.

> It will only remove config rather than whole gadget driver.

also, this is just wrong. You can't remove just one configuration, you
need to remove the whole thing and the host needs to see a
disconnection.

--
balbi

Attachment: signature.asc
Description: Digital signature