Re: [PATCH] usb: gadget: don't create new string_container if already exist
From: Andrzej Pietrasiewicz
Date: Tue Nov 04 2014 - 06:29:50 EST
W dniu 04.11.2014 o 12:05, Neil Zhang pisze:
-----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
<snip>
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.
What features do you think of?
Mainlining the android gadget has been attempted a number of times
and is unlikely to succeed.
A configurable gadget can be composed with configfs interface,
so no need to add anything new.
That said, I think that the proper way of eliminating the problem
described is freeing the resources on function unbind rather than
preventing composite from allocating more (duplicate) resources
on bind, which your patch does.
AP
--
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/