aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/composite.c12
-rw-r--r--include/linux/usb/composite.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 4aa0e4652228..366facccf4f6 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -215,6 +215,18 @@ done:
215} 215}
216EXPORT_SYMBOL_GPL(usb_add_function); 216EXPORT_SYMBOL_GPL(usb_add_function);
217 217
218void usb_remove_function(struct usb_configuration *c, struct usb_function *f)
219{
220 if (f->disable)
221 f->disable(f);
222
223 bitmap_zero(f->endpoints, 32);
224 list_del(&f->list);
225 if (f->unbind)
226 f->unbind(c, f);
227}
228EXPORT_SYMBOL_GPL(usb_remove_function);
229
218/** 230/**
219 * usb_function_deactivate - prevent function and gadget enumeration 231 * usb_function_deactivate - prevent function and gadget enumeration
220 * @function: the function that isn't yet ready to respond 232 * @function: the function that isn't yet ready to respond
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 3834e3330b23..8c7a6295ae78 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -461,6 +461,7 @@ struct usb_configuration *usb_get_config(struct usb_composite_dev *cdev,
461 int val); 461 int val);
462int usb_add_config_only(struct usb_composite_dev *cdev, 462int usb_add_config_only(struct usb_composite_dev *cdev,
463 struct usb_configuration *config); 463 struct usb_configuration *config);
464void usb_remove_function(struct usb_configuration *c, struct usb_function *f);
464 465
465#define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \ 466#define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \
466 static struct usb_function_driver _name ## usb_func = { \ 467 static struct usb_function_driver _name ## usb_func = { \