Hi Felipe, This is the follow-up: http://marc.info/?l=linux-usb&m=140979297227434&w=2. Sorry for late. In the first patch, we introduce an internal APIs which are used to find corresponding udc according to usb_gadget, it can simplify the code structure. In the 2nd patch, it maintains flag 'vbus' as vbus status, and try to connect or disconnect gadget according to vbus status. In the 3rd patch, it maintains count 'deactivations' for connect or disconnect gadget according to function/user behavior. If you agree with handing dp like above way, I will have two patchset, one for udc driver for 'vbus' and another for function driver for 'deactivations'. Thank you. Changes for v5(all for patch [3/3]): - Add mutux_lock to protect deactivation count - Add warning if deactivation is 0, but the user still wants to activate - Add more comments in commit log and code Changes for v4: - Add Alan's Ack Changes for v3: - Add mutex_lock protect for list_del(&udc->list) at usb_del_gadget_udc [Patch 1/3] - Drop former [Patch 2/4] which is useless Changes for v2: - introduce two internal APIs to simplify the code structure. - Teach patch 3/4 and 4/4 to use the new introduced API. Peter Chen (3): usb: udc: add usb_gadget_find_udc usb: udc: add usb_udc_vbus_handler usb: udc: add usb_udc_activation_handler drivers/usb/gadget/udc/udc-core.c | 118 +++++++++++++++++++++++++++++--------- include/linux/usb/gadget.h | 9 +++ 2 files changed, 101 insertions(+), 26 deletions(-) -- 1.9.1 -- 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