Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249096
b: refs/heads/master
c: 11ff12f
h: refs/heads/master
v: v3
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Apr 21, 2011
1 parent a23543d commit 6b83142
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 76 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: 24742ac69249500f650fd72cf0755932c5a4c247
refs/heads/master: 11ff12feb40dc663cad0f2da86729f1af9d1356e
143 changes: 68 additions & 75 deletions trunk/drivers/staging/easycap/easycap_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2975,13 +2975,13 @@ static const struct v4l2_file_operations v4l2_fops = {
* TIMES, ONCE FOR EACH OF THE THREE INTERFACES. BEWARE.
*/
/*---------------------------------------------------------------------------*/
static int easycap_usb_probe(struct usb_interface *pusb_interface,
const struct usb_device_id *pusb_device_id)
static int easycap_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *pusb_device;
struct usb_host_interface *pusb_host_interface;
struct usb_endpoint_descriptor *pepd;
struct usb_interface_descriptor *pusb_interface_descriptor;
struct usb_device *usbdev;
struct usb_host_interface *alt;
struct usb_endpoint_descriptor *ep;
struct usb_interface_descriptor *interface;
struct urb *purb;
struct easycap *peasycap;
int ndong;
Expand Down Expand Up @@ -3010,40 +3010,33 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
struct inputset *inputset;
struct v4l2_device *pv4l2_device;

/*---------------------------------------------------------------------------*/
/*
* GET POINTER TO STRUCTURE usb_device
*/
/*---------------------------------------------------------------------------*/
pusb_device = interface_to_usbdev(pusb_interface);
usbdev = interface_to_usbdev(intf);

JOT(4, "bNumConfigurations=%i\n", pusb_device->descriptor.bNumConfigurations);
/*---------------------------------------------------------------------------*/
pusb_host_interface = pusb_interface->cur_altsetting;
if (!pusb_host_interface) {
SAY("ERROR: pusb_host_interface is NULL\n");
alt = usb_altnum_to_altsetting(intf, 0);
if (!alt) {
SAY("ERROR: usb_host_interface not found\n");
return -EFAULT;
}
pusb_interface_descriptor = &(pusb_host_interface->desc);
if (!pusb_interface_descriptor) {
SAY("ERROR: pusb_interface_descriptor is NULL\n");
interface = &alt->desc;
if (!interface) {
SAY("ERROR: intf_descriptor is NULL\n");
return -EFAULT;
}
/*---------------------------------------------------------------------------*/
/*
* GET PROPERTIES OF PROBED INTERFACE
*/
/*---------------------------------------------------------------------------*/
bInterfaceNumber = pusb_interface_descriptor->bInterfaceNumber;
bInterfaceClass = pusb_interface_descriptor->bInterfaceClass;
bInterfaceSubClass = pusb_interface_descriptor->bInterfaceSubClass;
bInterfaceNumber = interface->bInterfaceNumber;
bInterfaceClass = interface->bInterfaceClass;
bInterfaceSubClass = interface->bInterfaceSubClass;

JOT(4, "intf[%i]: num_altsetting=%i\n",
bInterfaceNumber, pusb_interface->num_altsetting);
bInterfaceNumber, intf->num_altsetting);
JOT(4, "intf[%i]: cur_altsetting - altsetting=%li\n",
bInterfaceNumber,
(long int)(pusb_interface->cur_altsetting -
pusb_interface->altsetting));
(long int)(intf->cur_altsetting - intf->altsetting));
JOT(4, "intf[%i]: bInterfaceClass=0x%02X bInterfaceSubClass=0x%02X\n",
bInterfaceNumber, bInterfaceClass, bInterfaceSubClass);
/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -3129,8 +3122,8 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
* ... AND FURTHER INITIALIZE THE STRUCTURE
*/
/*---------------------------------------------------------------------------*/
peasycap->pusb_device = pusb_device;
peasycap->pusb_interface = pusb_interface;
peasycap->pusb_device = usbdev;
peasycap->pusb_interface = intf;

peasycap->ilk = 0;
peasycap->microphone = false;
Expand Down Expand Up @@ -3264,7 +3257,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
*/
/*---------------------------------------------------------------------------*/
for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
if (pusb_device == easycapdc60_dongle[ndong].peasycap->
if (usbdev == easycapdc60_dongle[ndong].peasycap->
pusb_device) {
peasycap = easycapdc60_dongle[ndong].peasycap;
JOT(8, "intf[%i]: dongle[%i].peasycap\n",
Expand All @@ -3291,7 +3284,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
*/
/*---------------------------------------------------------------------------*/
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
pv4l2_device = usb_get_intfdata(pusb_interface);
pv4l2_device = usb_get_intfdata(intf);
if (!pv4l2_device) {
SAY("ERROR: pv4l2_device is NULL\n");
return -ENODEV;
Expand Down Expand Up @@ -3340,34 +3333,34 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
/*---------------------------------------------------------------------------*/
isokalt = 0;

for (i = 0; i < pusb_interface->num_altsetting; i++) {
pusb_host_interface = &(pusb_interface->altsetting[i]);
if (!pusb_host_interface) {
SAM("ERROR: pusb_host_interface is NULL\n");
for (i = 0; i < intf->num_altsetting; i++) {
alt = usb_altnum_to_altsetting(intf, i);
if (!alt) {
SAM("ERROR: alt is NULL\n");
return -EFAULT;
}
pusb_interface_descriptor = &(pusb_host_interface->desc);
if (!pusb_interface_descriptor) {
SAM("ERROR: pusb_interface_descriptor is NULL\n");
interface = &alt->desc;
if (!interface) {
SAM("ERROR: intf_descriptor is NULL\n");
return -EFAULT;
}

JOM(4, "intf[%i]alt[%i]: desc.bDescriptorType=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bDescriptorType);
bInterfaceNumber, i, interface->bDescriptorType);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceNumber=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceNumber);
bInterfaceNumber, i, interface->bInterfaceNumber);
JOM(4, "intf[%i]alt[%i]: desc.bAlternateSetting=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bAlternateSetting);
bInterfaceNumber, i, interface->bAlternateSetting);
JOM(4, "intf[%i]alt[%i]: desc.bNumEndpoints=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bNumEndpoints);
bInterfaceNumber, i, interface->bNumEndpoints);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceClass=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceClass);
bInterfaceNumber, i, interface->bInterfaceClass);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceSubClass=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceSubClass);
bInterfaceNumber, i, interface->bInterfaceSubClass);
JOM(4, "intf[%i]alt[%i]: desc.bInterfaceProtocol=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->bInterfaceProtocol);
bInterfaceNumber, i, interface->bInterfaceProtocol);
JOM(4, "intf[%i]alt[%i]: desc.iInterface=0x%02X\n",
bInterfaceNumber, i, pusb_interface_descriptor->iInterface);
bInterfaceNumber, i, interface->iInterface);

ISOCwMaxPacketSize = -1;
BULKwMaxPacketSize = -1;
Expand All @@ -3376,34 +3369,34 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
ISOCbEndpointAddress = 0;
INTbEndpointAddress = 0;

if (0 == pusb_interface_descriptor->bNumEndpoints)
if (0 == interface->bNumEndpoints)
JOM(4, "intf[%i]alt[%i] has no endpoints\n",
bInterfaceNumber, i);
/*---------------------------------------------------------------------------*/
for (j = 0; j < pusb_interface_descriptor->bNumEndpoints; j++) {
pepd = &(pusb_host_interface->endpoint[j].desc);
if (!pepd) {
SAM("ERROR: pepd is NULL.\n");
for (j = 0; j < interface->bNumEndpoints; j++) {
ep = &alt->endpoint[j].desc;
if (!ep) {
SAM("ERROR: ep is NULL.\n");
SAM("...... skipping\n");
continue;
}
wMaxPacketSize = le16_to_cpu(pepd->wMaxPacketSize);
bEndpointAddress = pepd->bEndpointAddress;
wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize);
bEndpointAddress = ep->bEndpointAddress;

JOM(4, "intf[%i]alt[%i]end[%i]: bEndpointAddress=0x%X\n",
bInterfaceNumber, i, j,
pepd->bEndpointAddress);
ep->bEndpointAddress);
JOM(4, "intf[%i]alt[%i]end[%i]: bmAttributes=0x%X\n",
bInterfaceNumber, i, j,
pepd->bmAttributes);
ep->bmAttributes);
JOM(4, "intf[%i]alt[%i]end[%i]: wMaxPacketSize=%i\n",
bInterfaceNumber, i, j,
pepd->wMaxPacketSize);
ep->wMaxPacketSize);
JOM(4, "intf[%i]alt[%i]end[%i]: bInterval=%i\n",
bInterfaceNumber, i, j,
pepd->bInterval);
ep->bInterval);

if (pepd->bEndpointAddress & USB_DIR_IN) {
if (ep->bEndpointAddress & USB_DIR_IN) {
JOM(4, "intf[%i]alt[%i]end[%i] is an IN endpoint\n",
bInterfaceNumber, i, j);
isin = 1;
Expand All @@ -3414,7 +3407,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
SAM("...... continuing\n");
isin = 0;
}
if ((pepd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_ISOC) {
JOM(4, "intf[%i]alt[%i]end[%i] is an ISOC endpoint\n",
bInterfaceNumber, i, j);
Expand All @@ -3427,23 +3420,23 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
"peasycap is NULL\n");
return -EFAULT;
}
if (pepd->wMaxPacketSize) {
if (ep->wMaxPacketSize) {
if (8 > isokalt) {
okalt[isokalt] = i;
JOM(4,
"%i=okalt[%i]\n",
okalt[isokalt],
isokalt);
okepn[isokalt] =
pepd->
ep->
bEndpointAddress &
0x0F;
JOM(4,
"%i=okepn[%i]\n",
okepn[isokalt],
isokalt);
okmps[isokalt] =
le16_to_cpu(pepd->
le16_to_cpu(ep->
wMaxPacketSize);
JOM(4,
"%i=okmps[%i]\n",
Expand Down Expand Up @@ -3485,23 +3478,23 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
"peasycap is NULL\n");
return -EFAULT;
}
if (pepd->wMaxPacketSize) {
if (ep->wMaxPacketSize) {
if (8 > isokalt) {
okalt[isokalt] = i ;
JOM(4,
"%i=okalt[%i]\n",
okalt[isokalt],
isokalt);
okepn[isokalt] =
pepd->
ep->
bEndpointAddress &
0x0F;
JOM(4,
"%i=okepn[%i]\n",
okepn[isokalt],
isokalt);
okmps[isokalt] =
le16_to_cpu(pepd->
le16_to_cpu(ep->
wMaxPacketSize);
JOM(4,
"%i=okmps[%i]\n",
Expand Down Expand Up @@ -3539,12 +3532,12 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
break;
}
}
} else if ((pepd->bmAttributes &
} else if ((ep->bmAttributes &
USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK) {
JOM(4, "intf[%i]alt[%i]end[%i] is a BULK endpoint\n",
bInterfaceNumber, i, j);
} else if ((pepd->bmAttributes &
} 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",
Expand All @@ -3553,7 +3546,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
JOM(4, "intf[%i]alt[%i]end[%i] is a CTRL endpoint\n",
bInterfaceNumber, i, j);
}
if (0 == pepd->wMaxPacketSize) {
if (0 == ep->wMaxPacketSize) {
JOM(4, "intf[%i]alt[%i]end[%i] "
"has zero packet size\n",
bInterfaceNumber, i, j);
Expand All @@ -3566,7 +3559,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
*/
/*---------------------------------------------------------------------------*/
JOM(4, "initialization begins for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber);
interface->bInterfaceNumber);
switch (bInterfaceNumber) {
/*---------------------------------------------------------------------------*/
/*
Expand Down Expand Up @@ -3833,7 +3826,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
* SAVE POINTER peasycap IN THIS INTERFACE.
*/
/*--------------------------------------------------------------------------*/
usb_set_intfdata(pusb_interface, peasycap);
usb_set_intfdata(intf, peasycap);
/*---------------------------------------------------------------------------*/
/*
* IT IS ESSENTIAL TO INITIALIZE THE HARDWARE BEFORE, RATHER THAN AFTER,
Expand All @@ -3855,7 +3848,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
* THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
*/
/*--------------------------------------------------------------------------*/
if (0 != (v4l2_device_register(&(pusb_interface->dev),
if (0 != (v4l2_device_register(&(intf->dev),
&(peasycap->v4l2_device)))) {
SAM("v4l2_device_register() failed\n");
return -ENODEV;
Expand Down Expand Up @@ -3913,9 +3906,9 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
* SAVE POINTER peasycap IN INTERFACE 1
*/
/*--------------------------------------------------------------------------*/
usb_set_intfdata(pusb_interface, peasycap);
usb_set_intfdata(intf, peasycap);
JOM(4, "no initialization required for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber);
interface->bInterfaceNumber);
break;
}
/*--------------------------------------------------------------------------*/
Expand Down Expand Up @@ -4177,7 +4170,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
* SAVE POINTER peasycap IN THIS INTERFACE.
*/
/*---------------------------------------------------------------------------*/
usb_set_intfdata(pusb_interface, peasycap);
usb_set_intfdata(intf, peasycap);
/*---------------------------------------------------------------------------*/
/*
* THE AUDIO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
Expand All @@ -4198,18 +4191,18 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
}

#else /* CONFIG_EASYCAP_OSS */
rc = usb_register_dev(pusb_interface, &easyoss_class);
rc = usb_register_dev(intf, &easyoss_class);
if (rc) {
SAY("ERROR: usb_register_dev() failed\n");
usb_set_intfdata(pusb_interface, NULL);
usb_set_intfdata(intf, NULL);
return -ENODEV;
} else {
JOM(8, "kref_get() with %i=kref.refcount.counter\n",
peasycap->kref.refcount.counter);
kref_get(&peasycap->kref);
peasycap->registered_audio++;
}
SAM("easyoss attached to minor #%d\n", pusb_interface->minor);
SAM("easyoss attached to minor #%d\n", intf->minor);
#endif /* CONFIG_EASYCAP_OSS */

break;
Expand Down

0 comments on commit 6b83142

Please sign in to comment.