/* Index = (epnum * 2) + direction - 1, where direction = 0 for OUT, 1 for IN. For control endpoints, the IN index is used (OUT index is unused), so index = (epnum * 2) + direction - 1 = (epnum * 2) + 1 - 1 = (epnum * 2)  */
unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc)
/* Index = (epnum * 2) + direction - 1, where direction = 0 for OUT, 1 for IN. For control endpoints, the IN index is used (OUT index is unused), so index = (epnum * 2) + direction - 1 = (epnum * 2) + 1 - 1 = (epnum * 2)  */
unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc)
{
	unsigned int index;
	if (usb_endpoint_xfer_control(desc))
		index = (unsigned int) (usb_endpoint_num(desc)*2);
	else
		index = (unsigned int) (usb_endpoint_num(desc)*2) +
			(usb_endpoint_dir_in(desc) ? 1 : 0) - 1;
	return index;
}