summaryrefslogtreecommitdiff
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-10-21 11:00:58 +0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2014-03-05 03:38:12 +0400
commite1be067b681054e963dfd01346c0d7fc0f8a63aa (patch)
tree319784dc99999a433e63f57d01e16208aa5f6b79 /drivers/usb/storage
parentd3f7c1560aee57d0ec293253e0c0e79a84ea3016 (diff)
downloadlinux-e1be067b681054e963dfd01346c0d7fc0f8a63aa.tar.xz
uas: Add a uas_find_uas_alt_setting helper function
This is a preparation patch for teaching usb-storage to not bind to uas devices. 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')
-rw-r--r--drivers/usb/storage/uas.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 3f021f2fafdf..54db36541b93 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -892,10 +892,10 @@ static int uas_isnt_supported(struct usb_device *udev)
return -ENODEV;
}
-static int uas_switch_interface(struct usb_device *udev,
- struct usb_interface *intf)
+static int uas_find_uas_alt_setting(struct usb_interface *intf)
{
int i;
+ struct usb_device *udev = interface_to_usbdev(intf);
int sg_supported = udev->bus->sg_tablesize != 0;
for (i = 0; i < intf->num_altsetting; i++) {
@@ -904,15 +904,26 @@ static int uas_switch_interface(struct usb_device *udev,
if (uas_is_interface(alt)) {
if (!sg_supported)
return uas_isnt_supported(udev);
- return usb_set_interface(udev,
- alt->desc.bInterfaceNumber,
- alt->desc.bAlternateSetting);
+ return alt->desc.bAlternateSetting;
}
}
return -ENODEV;
}
+static int uas_switch_interface(struct usb_device *udev,
+ struct usb_interface *intf)
+{
+ int alt;
+
+ alt = uas_find_uas_alt_setting(intf);
+ if (alt < 0)
+ return alt;
+
+ return usb_set_interface(udev,
+ intf->altsetting[0].desc.bInterfaceNumber, alt);
+}
+
static void uas_configure_endpoints(struct uas_dev_info *devinfo)
{
struct usb_host_endpoint *eps[4] = { };