Commit e1be067b authored by Hans de Goede's avatar Hans de Goede Committed by Sarah Sharp
Browse files

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: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
parent d3f7c156
...@@ -892,10 +892,10 @@ static int uas_isnt_supported(struct usb_device *udev) ...@@ -892,10 +892,10 @@ static int uas_isnt_supported(struct usb_device *udev)
return -ENODEV; return -ENODEV;
} }
static int uas_switch_interface(struct usb_device *udev, static int uas_find_uas_alt_setting(struct usb_interface *intf)
struct usb_interface *intf)
{ {
int i; int i;
struct usb_device *udev = interface_to_usbdev(intf);
int sg_supported = udev->bus->sg_tablesize != 0; int sg_supported = udev->bus->sg_tablesize != 0;
for (i = 0; i < intf->num_altsetting; i++) { for (i = 0; i < intf->num_altsetting; i++) {
...@@ -904,15 +904,26 @@ static int uas_switch_interface(struct usb_device *udev, ...@@ -904,15 +904,26 @@ static int uas_switch_interface(struct usb_device *udev,
if (uas_is_interface(alt)) { if (uas_is_interface(alt)) {
if (!sg_supported) if (!sg_supported)
return uas_isnt_supported(udev); return uas_isnt_supported(udev);
return usb_set_interface(udev, return alt->desc.bAlternateSetting;
alt->desc.bInterfaceNumber,
alt->desc.bAlternateSetting);
} }
} }
return -ENODEV; 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) static void uas_configure_endpoints(struct uas_dev_info *devinfo)
{ {
struct usb_host_endpoint *eps[4] = { }; struct usb_host_endpoint *eps[4] = { };
......
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