]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: composite: add bind_deactivated flag to usb_function
authorRobert Baldyga <r.baldyga@samsung.com>
Mon, 4 May 2015 12:55:13 +0000 (14:55 +0200)
committerFelipe Balbi <balbi@ti.com>
Wed, 29 Jul 2015 14:59:19 +0000 (09:59 -0500)
This patch introduces 'bind_deactivated' flag in struct usb_function.
Functions which don't want to be activated automatically after bind should
set this flag, and when they start to be ready to work they should call
usb_function_activate().

When USB function sets 'bind_deactivated' flag, initial deactivation
counter is incremented automatically, so there is no need to call
usb_function_deactivate() in function bind.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/composite.c
include/linux/usb/composite.h

index 86d4e8fdf8d300c91f78191ef1aa7486384be2d1..36c6f47642f8f3b73362d870bd1d75c0de8acac4 100644 (file)
@@ -209,6 +209,12 @@ int usb_add_function(struct usb_configuration *config,
        function->config = config;
        list_add_tail(&function->list, &config->functions);
 
+       if (function->bind_deactivated) {
+               value = usb_function_deactivate(function);
+               if (value)
+                       goto done;
+       }
+
        /* REVISIT *require* function->bind? */
        if (function->bind) {
                value = function->bind(config, function);
index 2511469a99048996fa53232801fdb6a72bb90d4b..1074b8921a5dc59dda948ef39e7281f63d420efb 100644 (file)
@@ -228,6 +228,8 @@ struct usb_function {
        struct list_head                list;
        DECLARE_BITMAP(endpoints, 32);
        const struct usb_function_instance *fi;
+
+       unsigned int            bind_deactivated:1;
 };
 
 int usb_add_function(struct usb_configuration *, struct usb_function *);