summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorJoe Swantek <joseph.swantek@motorola.com>2009-12-15 07:17:40 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:12:07 -0700
commitd384394c04c9f9ae04cb0a7677d871205483193c (patch)
tree2fadbda1c503a3d13db762769b81ee009ff8a6b5 /drivers/usb/gadget/composite.c
parentc82a19f83dbb0145391ea032038c74b010e8b7f2 (diff)
USB: composite: Allow configurations to handle unhandled setup requests
Signed-off-by: Mike Lockwood <lockwood@android.com> Change-Id: I5b5ffd02578ccd92e6909735f259e39f5143339b Reviewed-on: http://git-master/r/110674 Reviewed-by: Prashant Malani <pmalani@nvidia.com> Tested-by: Prashant Malani <pmalani@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bo Yan <byan@nvidia.com> Rebase-Id: Ra322344422946076110063e93087067388cbcafe
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index a224eb57a967..b6f2b3f76085 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1466,6 +1466,25 @@ unknown:
value = c->setup(c, ctrl);
}
+ /* If the vendor request is not processed (value < 0),
+ * call all device registered configure setup callbacks
+ * to process it.
+ * This is used to handle the following cases:
+ * - vendor request is for the device and arrives before
+ * setconfiguration.
+ * - Some devices are required to handle vendor request before
+ * setconfiguration such as MTP, USBNET.
+ */
+
+ if (value < 0) {
+ struct usb_configuration *cfg;
+
+ list_for_each_entry(cfg, &cdev->configs, list) {
+ if (cfg && cfg->setup)
+ value = cfg->setup(cfg, ctrl);
+ }
+ }
+
goto done;
}