usb: gadget: configfs: Correct usb functions order for UDC gadget bind

During multiple adb reboots test case, adbd is taking time to start
and write the descriptors from the userspace. If adb is their in the
composition and its not ready when bind happens, UDC bind for ffs will
fail and adding the function back to the func_list in failure path and
calling purge_configs_funcs.

In purge_func adb driver unbind the functions from config->functions list
and add back to the tail of the func_list. With this order of the functions
in func_list got changed and next time when bind happens from adbd start
usb does not working.

Fix this issue by changing the order of the functions while adding the
functions back to the list in purge_configs_funcs.

Change-Id: I50c2362062130836d66edfcf8e1f020134248cb4
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
This commit is contained in:
Chandana Kishori Chiluveru 2018-06-18 17:23:18 +05:30 committed by Gerrit - the friendly Code Review server
parent 2386158c7b
commit 8b8a942bd1

View file

@ -1259,9 +1259,9 @@ static void purge_configs_funcs(struct gadget_info *gi)
cfg = container_of(c, struct config_usb_cfg, c);
list_for_each_entry_safe(f, tmp, &c->functions, list) {
list_for_each_entry_safe_reverse(f, tmp, &c->functions, list) {
list_move_tail(&f->list, &cfg->func_list);
list_move(&f->list, &cfg->func_list);
if (f->unbind) {
dev_err(&gi->cdev.gadget->dev, "unbind function"
" '%s'/%pK\n", f->name, f);