Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227030
b: refs/heads/master
c: 89dc290
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Wilcox authored and Greg Kroah-Hartman committed Dec 15, 2010
1 parent f4ae3f7 commit c88e401
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 92a3f767f5cd079351ae04a337c40266e9c6048f
refs/heads/master: 89dc29051b626756e69db12f3ffb22e49a817bfe
37 changes: 30 additions & 7 deletions trunk/drivers/usb/storage/uas.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,34 @@ static struct usb_device_id uas_usb_ids[] = {
};
MODULE_DEVICE_TABLE(usb, uas_usb_ids);

static int uas_is_interface(struct usb_host_interface *intf)
{
return (intf->desc.bInterfaceClass == USB_CLASS_MASS_STORAGE &&
intf->desc.bInterfaceSubClass == USB_SC_SCSI &&
intf->desc.bInterfaceProtocol == USB_PR_UAS);
}

static int uas_switch_interface(struct usb_device *udev,
struct usb_interface *intf)
{
int i;

if (uas_is_interface(intf->cur_altsetting))
return 0;

for (i = 0; i < intf->num_altsetting; i++) {
struct usb_host_interface *alt = &intf->altsetting[i];
if (alt == intf->cur_altsetting)
continue;
if (uas_is_interface(alt))
return usb_set_interface(udev,
alt->desc.bInterfaceNumber,
alt->desc.bAlternateSetting);
}

return -ENODEV;
}

static void uas_configure_endpoints(struct uas_dev_info *devinfo)
{
struct usb_host_endpoint *eps[4] = { };
Expand Down Expand Up @@ -655,13 +683,8 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
struct uas_dev_info *devinfo;
struct usb_device *udev = interface_to_usbdev(intf);

if (id->bInterfaceProtocol == 0x50) {
int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
/* XXX: Shouldn't assume that 1 is the alternative we want */
int ret = usb_set_interface(udev, ifnum, 1);
if (ret)
return -ENODEV;
}
if (uas_switch_interface(udev, intf))
return -ENODEV;

devinfo = kmalloc(sizeof(struct uas_dev_info), GFP_KERNEL);
if (!devinfo)
Expand Down

0 comments on commit c88e401

Please sign in to comment.