diff options
Diffstat (limited to 'sound/usb/usbmidi.c')
-rw-r--r-- | sound/usb/usbmidi.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 6d9f9b135c62..320641ab5be7 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1392,8 +1392,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1392 | for (i = 0; i < intfd->bNumEndpoints; ++i) { | 1392 | for (i = 0; i < intfd->bNumEndpoints; ++i) { |
1393 | hostep = &hostif->endpoint[i]; | 1393 | hostep = &hostif->endpoint[i]; |
1394 | ep = get_ep_desc(hostep); | 1394 | ep = get_ep_desc(hostep); |
1395 | if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && | 1395 | if (!usb_endpoint_xfer_bulk(ep) && !usb_endpoint_xfer_int(ep)) |
1396 | (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | ||
1397 | continue; | 1396 | continue; |
1398 | ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra; | 1397 | ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra; |
1399 | if (hostep->extralen < 4 || | 1398 | if (hostep->extralen < 4 || |
@@ -1401,15 +1400,15 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1401 | ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || | 1400 | ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || |
1402 | ms_ep->bDescriptorSubtype != MS_GENERAL) | 1401 | ms_ep->bDescriptorSubtype != MS_GENERAL) |
1403 | continue; | 1402 | continue; |
1404 | if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { | 1403 | if (usb_endpoint_dir_out(ep)) { |
1405 | if (endpoints[epidx].out_ep) { | 1404 | if (endpoints[epidx].out_ep) { |
1406 | if (++epidx >= MIDI_MAX_ENDPOINTS) { | 1405 | if (++epidx >= MIDI_MAX_ENDPOINTS) { |
1407 | snd_printk(KERN_WARNING "too many endpoints\n"); | 1406 | snd_printk(KERN_WARNING "too many endpoints\n"); |
1408 | break; | 1407 | break; |
1409 | } | 1408 | } |
1410 | } | 1409 | } |
1411 | endpoints[epidx].out_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1410 | endpoints[epidx].out_ep = usb_endpoint_num(ep); |
1412 | if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1411 | if (usb_endpoint_xfer_int(ep)) |
1413 | endpoints[epidx].out_interval = ep->bInterval; | 1412 | endpoints[epidx].out_interval = ep->bInterval; |
1414 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1413 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) |
1415 | /* | 1414 | /* |
@@ -1428,8 +1427,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi, | |||
1428 | break; | 1427 | break; |
1429 | } | 1428 | } |
1430 | } | 1429 | } |
1431 | endpoints[epidx].in_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1430 | endpoints[epidx].in_ep = usb_endpoint_num(ep); |
1432 | if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1431 | if (usb_endpoint_xfer_int(ep)) |
1433 | endpoints[epidx].in_interval = ep->bInterval; | 1432 | endpoints[epidx].in_interval = ep->bInterval; |
1434 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) | 1433 | else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) |
1435 | endpoints[epidx].in_interval = 1; | 1434 | endpoints[epidx].in_interval = 1; |
@@ -1495,20 +1494,20 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi, | |||
1495 | 1494 | ||
1496 | for (i = 0; i < intfd->bNumEndpoints; ++i) { | 1495 | for (i = 0; i < intfd->bNumEndpoints; ++i) { |
1497 | epd = get_endpoint(hostif, i); | 1496 | epd = get_endpoint(hostif, i); |
1498 | if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && | 1497 | if (!usb_endpoint_xfer_bulk(epd) && |
1499 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) | 1498 | !usb_endpoint_xfer_int(epd)) |
1500 | continue; | 1499 | continue; |
1501 | if (out_eps < max_endpoints && | 1500 | if (out_eps < max_endpoints && |
1502 | (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { | 1501 | usb_endpoint_dir_out(epd)) { |
1503 | endpoint[out_eps].out_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1502 | endpoint[out_eps].out_ep = usb_endpoint_num(epd); |
1504 | if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1503 | if (usb_endpoint_xfer_int(epd)) |
1505 | endpoint[out_eps].out_interval = epd->bInterval; | 1504 | endpoint[out_eps].out_interval = epd->bInterval; |
1506 | ++out_eps; | 1505 | ++out_eps; |
1507 | } | 1506 | } |
1508 | if (in_eps < max_endpoints && | 1507 | if (in_eps < max_endpoints && |
1509 | (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) { | 1508 | usb_endpoint_dir_in(epd)) { |
1510 | endpoint[in_eps].in_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1509 | endpoint[in_eps].in_ep = usb_endpoint_num(epd); |
1511 | if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) | 1510 | if (usb_endpoint_xfer_int(epd)) |
1512 | endpoint[in_eps].in_interval = epd->bInterval; | 1511 | endpoint[in_eps].in_interval = epd->bInterval; |
1513 | ++in_eps; | 1512 | ++in_eps; |
1514 | } | 1513 | } |
@@ -1607,21 +1606,19 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
1607 | } | 1606 | } |
1608 | 1607 | ||
1609 | epd = get_endpoint(hostif, 0); | 1608 | epd = get_endpoint(hostif, 0); |
1610 | if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN || | 1609 | if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) { |
1611 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) { | ||
1612 | snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); | 1610 | snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); |
1613 | return -ENXIO; | 1611 | return -ENXIO; |
1614 | } | 1612 | } |
1615 | epd = get_endpoint(hostif, 2); | 1613 | epd = get_endpoint(hostif, 2); |
1616 | if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || | 1614 | if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) { |
1617 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) { | ||
1618 | snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); | 1615 | snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); |
1619 | return -ENXIO; | 1616 | return -ENXIO; |
1620 | } | 1617 | } |
1621 | if (endpoint->out_cables > 0x0001) { | 1618 | if (endpoint->out_cables > 0x0001) { |
1622 | epd = get_endpoint(hostif, 4); | 1619 | epd = get_endpoint(hostif, 4); |
1623 | if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || | 1620 | if (!usb_endpoint_dir_out(epd) || |
1624 | (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) { | 1621 | !usb_endpoint_xfer_bulk(epd)) { |
1625 | snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); | 1622 | snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); |
1626 | return -ENXIO; | 1623 | return -ENXIO; |
1627 | } | 1624 | } |