Commit 1d243c2e authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/easycap: probe: simplify the endpoints tests

we are interested only in isochronous in endpoints
so we can simplify the flow

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 49c30e57
...@@ -2988,7 +2988,7 @@ static int easycap_usb_probe(struct usb_interface *intf, ...@@ -2988,7 +2988,7 @@ static int easycap_usb_probe(struct usb_interface *intf,
struct data_urb *pdata_urb; struct data_urb *pdata_urb;
size_t wMaxPacketSize; size_t wMaxPacketSize;
u8 bEndpointAddress; u8 bEndpointAddress;
int isin, i, j, k, m, rc; int i, j, k, m, rc;
u8 bInterfaceNumber; u8 bInterfaceNumber;
u8 bInterfaceClass; u8 bInterfaceClass;
u8 bInterfaceSubClass; u8 bInterfaceSubClass;
...@@ -3353,155 +3353,130 @@ static int easycap_usb_probe(struct usb_interface *intf, ...@@ -3353,155 +3353,130 @@ static int easycap_usb_probe(struct usb_interface *intf,
wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize); wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize);
bEndpointAddress = ep->bEndpointAddress; bEndpointAddress = ep->bEndpointAddress;
if (ep->bEndpointAddress & USB_DIR_IN) {
JOM(4, "intf[%i]alt[%i]end[%i] is an IN endpoint\n", if (!usb_endpoint_is_isoc_in(ep)) {
bInterfaceNumber, i, j); JOM(4, "intf[%i]alt[%i]end[%i] is a %d endpoint\n",
isin = 1; bInterfaceNumber,
} else { i, j, ep->bmAttributes);
JOM(4, "intf[%i]alt[%i]end[%i] is an OUT endpoint\n", if (usb_endpoint_dir_out(ep)) {
bInterfaceNumber, i, j); SAM("ERROR: OUT endpoint unexpected\n");
SAM("ERROR: OUT endpoint unexpected\n"); SAM("...... continuing\n");
SAM("...... continuing\n"); }
isin = 0; continue;
} }
if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == switch (bInterfaceClass) {
USB_ENDPOINT_XFER_ISOC) { case USB_CLASS_VIDEO:
JOM(4, "intf[%i]alt[%i]end[%i] is an ISOC endpoint\n", case USB_CLASS_VENDOR_SPEC: {
bInterfaceNumber, i, j); if (ep->wMaxPacketSize) {
if (isin) { if (8 > isokalt) {
switch (bInterfaceClass) { okalt[isokalt] = i;
case USB_CLASS_VIDEO: JOM(4,
case USB_CLASS_VENDOR_SPEC: { "%i=okalt[%i]\n",
if (!peasycap) { okalt[isokalt],
SAM("MISTAKE: " isokalt);
"peasycap is NULL\n"); okepn[isokalt] =
return -EFAULT; ep->
} bEndpointAddress &
if (ep->wMaxPacketSize) { 0x0F;
if (8 > isokalt) { JOM(4,
okalt[isokalt] = i; "%i=okepn[%i]\n",
JOM(4, okepn[isokalt],
"%i=okalt[%i]\n", isokalt);
okalt[isokalt], okmps[isokalt] =
isokalt); le16_to_cpu(ep->
okepn[isokalt] = wMaxPacketSize);
ep-> JOM(4,
bEndpointAddress & "%i=okmps[%i]\n",
0x0F; okmps[isokalt],
JOM(4, isokalt);
"%i=okepn[%i]\n", isokalt++;
okepn[isokalt],
isokalt);
okmps[isokalt] =
le16_to_cpu(ep->
wMaxPacketSize);
JOM(4,
"%i=okmps[%i]\n",
okmps[isokalt],
isokalt);
isokalt++;
}
} else {
if (-1 == peasycap->
video_altsetting_off) {
peasycap->
video_altsetting_off =
i;
JOM(4, "%i=video_"
"altsetting_off "
"<====\n",
peasycap->
video_altsetting_off);
} else {
SAM("ERROR: peasycap"
"->video_altsetting_"
"off already set\n");
SAM("...... "
"continuing with "
"%i=peasycap->video_"
"altsetting_off\n",
peasycap->
video_altsetting_off);
}
}
break;
} }
case USB_CLASS_AUDIO: { } else {
if (bInterfaceSubClass != if (-1 == peasycap->
USB_SUBCLASS_AUDIOSTREAMING) video_altsetting_off) {
break; peasycap->
if (!peasycap) { video_altsetting_off =
SAM("MISTAKE: " i;
"peasycap is NULL\n"); JOM(4, "%i=video_"
return -EFAULT; "altsetting_off "
} "<====\n",
if (ep->wMaxPacketSize) { peasycap->
if (8 > isokalt) { video_altsetting_off);
okalt[isokalt] = i ; } else {
JOM(4, SAM("ERROR: peasycap"
"%i=okalt[%i]\n", "->video_altsetting_"
okalt[isokalt], "off already set\n");
isokalt); SAM("...... "
okepn[isokalt] = "continuing with "
ep-> "%i=peasycap->video_"
bEndpointAddress & "altsetting_off\n",
0x0F; peasycap->
JOM(4, video_altsetting_off);
"%i=okepn[%i]\n", }
okepn[isokalt], }
isokalt); break;
okmps[isokalt] = }
le16_to_cpu(ep-> case USB_CLASS_AUDIO: {
wMaxPacketSize); if (bInterfaceSubClass !=
JOM(4, USB_SUBCLASS_AUDIOSTREAMING)
"%i=okmps[%i]\n",
okmps[isokalt],
isokalt);
isokalt++;
}
} else {
if (-1 == peasycap->
audio_altsetting_off) {
peasycap->
audio_altsetting_off =
i;
JOM(4, "%i=audio_"
"altsetting_off "
"<====\n",
peasycap->
audio_altsetting_off);
} else {
SAM("ERROR: peasycap"
"->audio_altsetting_"
"off already set\n");
SAM("...... "
"continuing with "
"%i=peasycap->"
"audio_altsetting_"
"off\n",
peasycap->
audio_altsetting_off);
}
}
break; break;
if (!peasycap) {
SAM("MISTAKE: "
"peasycap is NULL\n");
return -EFAULT;
}
if (ep->wMaxPacketSize) {
if (8 > isokalt) {
okalt[isokalt] = i ;
JOM(4,
"%i=okalt[%i]\n",
okalt[isokalt],
isokalt);
okepn[isokalt] =
ep->
bEndpointAddress &
0x0F;
JOM(4,
"%i=okepn[%i]\n",
okepn[isokalt],
isokalt);
okmps[isokalt] =
le16_to_cpu(ep->
wMaxPacketSize);
JOM(4,
"%i=okmps[%i]\n",
okmps[isokalt],
isokalt);
isokalt++;
} }
default: } else {
break; if (-1 == peasycap->
audio_altsetting_off) {
peasycap->
audio_altsetting_off =
i;
JOM(4, "%i=audio_"
"altsetting_off "
"<====\n",
peasycap->
audio_altsetting_off);
} else {
SAM("ERROR: peasycap"
"->audio_altsetting_"
"off already set\n");
SAM("...... "
"continuing with "
"%i=peasycap->"
"audio_altsetting_"
"off\n",
peasycap->
audio_altsetting_off);
} }
} }
} else if ((ep->bmAttributes & break;
USB_ENDPOINT_XFERTYPE_MASK) == }
USB_ENDPOINT_XFER_BULK) { default:
JOM(4, "intf[%i]alt[%i]end[%i] is a BULK endpoint\n", break;
bInterfaceNumber, i, j);
} else if ((ep->bmAttributes &
USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_INT) {
JOM(4, "intf[%i]alt[%i]end[%i] is an INT endpoint\n",
bInterfaceNumber, i, j);
} else {
JOM(4, "intf[%i]alt[%i]end[%i] is a CTRL endpoint\n",
bInterfaceNumber, i, j);
} }
if (0 == ep->wMaxPacketSize) { if (0 == ep->wMaxPacketSize) {
JOM(4, "intf[%i]alt[%i]end[%i] " JOM(4, "intf[%i]alt[%i]end[%i] "
......
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