diff options
| author | Robert Baldyga <r.baldyga@samsung.com> | 2015-05-04 08:55:13 -0400 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2015-07-29 10:59:19 -0400 |
| commit | d5bb9b81dbfa35d117ecb58022ee6e7e41e4772d (patch) | |
| tree | 398dcc6d054fbf8c56c0bb767f3b63e4447767ce | |
| parent | 5601250bb1b4e736cf487d332f2d8d8833a84209 (diff) | |
usb: composite: add bind_deactivated flag to usb_function
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>
| -rw-r--r-- | drivers/usb/gadget/composite.c | 6 | ||||
| -rw-r--r-- | include/linux/usb/composite.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 86d4e8fdf8d3..36c6f47642f8 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
| @@ -209,6 +209,12 @@ int usb_add_function(struct usb_configuration *config, | |||
| 209 | function->config = config; | 209 | function->config = config; |
| 210 | list_add_tail(&function->list, &config->functions); | 210 | list_add_tail(&function->list, &config->functions); |
| 211 | 211 | ||
| 212 | if (function->bind_deactivated) { | ||
| 213 | value = usb_function_deactivate(function); | ||
| 214 | if (value) | ||
| 215 | goto done; | ||
| 216 | } | ||
| 217 | |||
| 212 | /* REVISIT *require* function->bind? */ | 218 | /* REVISIT *require* function->bind? */ |
| 213 | if (function->bind) { | 219 | if (function->bind) { |
| 214 | value = function->bind(config, function); | 220 | value = function->bind(config, function); |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 2511469a9904..1074b8921a5d 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -228,6 +228,8 @@ struct usb_function { | |||
| 228 | struct list_head list; | 228 | struct list_head list; |
| 229 | DECLARE_BITMAP(endpoints, 32); | 229 | DECLARE_BITMAP(endpoints, 32); |
| 230 | const struct usb_function_instance *fi; | 230 | const struct usb_function_instance *fi; |
| 231 | |||
| 232 | unsigned int bind_deactivated:1; | ||
| 231 | }; | 233 | }; |
| 232 | 234 | ||
| 233 | int usb_add_function(struct usb_configuration *, struct usb_function *); | 235 | int usb_add_function(struct usb_configuration *, struct usb_function *); |
