Each function driver should activate itself at its function driver when necessary. Most of functions would like to activate them just after binding, but some may have special requirements for when to activate themselves, eg, uvc, it needs the app to open video device first. We do not need to consider deactivations count when the bind has failed, since the usb_composite_dev will be reinitialized at calling composite_bind next time. Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx> --- drivers/usb/gadget/composite.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 770aa5e..64932ab 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -208,6 +208,11 @@ int usb_add_function(struct usb_configuration *config, function->config = config; list_add_tail(&function->list, &config->functions); + /* + * Deactive default, activates itself at each function driver + * according to requirement. + */ + usb_function_deactivate(function); /* REVISIT *require* function->bind? */ if (function->bind) { -- 1.7.9.5 -- 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