Commit d5bb9b81 authored by Robert Baldyga's avatar Robert Baldyga Committed by Felipe Balbi

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: default avatarRobert Baldyga <r.baldyga@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5601250b
...@@ -209,6 +209,12 @@ int usb_add_function(struct usb_configuration *config, ...@@ -209,6 +209,12 @@ int usb_add_function(struct usb_configuration *config,
function->config = config; function->config = config;
list_add_tail(&function->list, &config->functions); list_add_tail(&function->list, &config->functions);
if (function->bind_deactivated) {
value = usb_function_deactivate(function);
if (value)
goto done;
}
/* REVISIT *require* function->bind? */ /* REVISIT *require* function->bind? */
if (function->bind) { if (function->bind) {
value = function->bind(config, function); value = function->bind(config, function);
......
...@@ -228,6 +228,8 @@ struct usb_function { ...@@ -228,6 +228,8 @@ struct usb_function {
struct list_head list; struct list_head list;
DECLARE_BITMAP(endpoints, 32); DECLARE_BITMAP(endpoints, 32);
const struct usb_function_instance *fi; const struct usb_function_instance *fi;
unsigned int bind_deactivated:1;
}; };
int usb_add_function(struct usb_configuration *, struct usb_function *); int usb_add_function(struct usb_configuration *, struct usb_function *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment