Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9630d081 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: uas: fix bug in handling of alternate settings"

parents a088f113 bc686fa8
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -9,7 +9,8 @@ static int uas_is_interface(struct usb_host_interface *intf)
		intf->desc.bInterfaceProtocol == USB_PR_UAS);
}

static int uas_find_uas_alt_setting(struct usb_interface *intf)
static struct usb_host_interface *uas_find_uas_alt_setting(
		struct usb_interface *intf)
{
	int i;

@@ -17,10 +18,10 @@ static int uas_find_uas_alt_setting(struct usb_interface *intf)
		struct usb_host_interface *alt = &intf->altsetting[i];

		if (uas_is_interface(alt))
			return alt->desc.bAlternateSetting;
			return alt;
	}

	return -ENODEV;
	return NULL;
}

static int uas_find_endpoints(struct usb_host_interface *alt,
@@ -58,14 +59,14 @@ static int uas_use_uas_driver(struct usb_interface *intf,
	struct usb_device *udev = interface_to_usbdev(intf);
	struct usb_hcd *hcd = bus_to_hcd(udev->bus);
	unsigned long flags = id->driver_info;
	int r, alt;

	struct usb_host_interface *alt;
	int r;

	alt = uas_find_uas_alt_setting(intf);
	if (alt < 0)
	if (!alt)
		return 0;

	r = uas_find_endpoints(&intf->altsetting[alt], eps);
	r = uas_find_endpoints(alt, eps);
	if (r < 0)
		return 0;

+5 −5
Original line number Diff line number Diff line
@@ -854,14 +854,14 @@ MODULE_DEVICE_TABLE(usb, uas_usb_ids);
static int uas_switch_interface(struct usb_device *udev,
				struct usb_interface *intf)
{
	int alt;
	struct usb_host_interface *alt;

	alt = uas_find_uas_alt_setting(intf);
	if (alt < 0)
		return alt;
	if (!alt)
		return -ENODEV;

	return usb_set_interface(udev,
			intf->altsetting[0].desc.bInterfaceNumber, alt);
	return usb_set_interface(udev, alt->desc.bInterfaceNumber,
			alt->desc.bAlternateSetting);
}

static int uas_configure_endpoints(struct uas_dev_info *devinfo)