summaryrefslogtreecommitdiff
path: root/drivers/usb/storage/uas-detect.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-10-29 10:03:34 +0100
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2014-03-04 15:38:18 -0800
commitd77adc0284beea5783c52b2af49217a37c2114cd (patch)
tree08c7980863f7b8b24aacdeb1089425c4d18d2c43 /drivers/usb/storage/uas-detect.h
parentd495c1baa1b3ba277bb5ae24adeab0600151cba4 (diff)
uas: Move uas_find_endpoints to uas-detect.h
No changes, just the move. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/storage/uas-detect.h')
-rw-r--r--drivers/usb/storage/uas-detect.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h
index 082bde1fa74d..8de030a0a4a4 100644
--- a/drivers/usb/storage/uas-detect.h
+++ b/drivers/usb/storage/uas-detect.h
@@ -40,6 +40,33 @@ static int uas_find_uas_alt_setting(struct usb_interface *intf)
return -ENODEV;
}
+static int uas_find_endpoints(struct usb_host_interface *alt,
+ struct usb_host_endpoint *eps[])
+{
+ struct usb_host_endpoint *endpoint = alt->endpoint;
+ unsigned i, n_endpoints = alt->desc.bNumEndpoints;
+
+ for (i = 0; i < n_endpoints; i++) {
+ unsigned char *extra = endpoint[i].extra;
+ int len = endpoint[i].extralen;
+ while (len >= 3) {
+ if (extra[1] == USB_DT_PIPE_USAGE) {
+ unsigned pipe_id = extra[2];
+ if (pipe_id > 0 && pipe_id < 5)
+ eps[pipe_id - 1] = &endpoint[i];
+ break;
+ }
+ len -= extra[0];
+ extra += extra[0];
+ }
+ }
+
+ if (!eps[0] || !eps[1] || !eps[2] || !eps[3])
+ return -ENODEV;
+
+ return 0;
+}
+
static int uas_use_uas_driver(struct usb_interface *intf,
const struct usb_device_id *id)
{