Commit 7dcef374 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/easycap: add level 1 tabs in usb_probe/disconnect function

Add first level indentation before revamping the functions
This of course breaks 80 characters limit but it will be
fixed through the revamp
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 30a2cb35
......@@ -3145,139 +3145,139 @@ static const struct v4l2_file_operations v4l2_fops = {
static int easycap_usb_probe(struct usb_interface *pusb_interface,
const struct usb_device_id *pusb_device_id)
{
struct usb_device *pusb_device, *pusb_device1;
struct usb_host_interface *pusb_host_interface;
struct usb_endpoint_descriptor *pepd;
struct usb_interface_descriptor *pusb_interface_descriptor;
struct usb_interface_assoc_descriptor *pusb_interface_assoc_descriptor;
struct urb *purb;
struct easycap *peasycap;
int ndong;
struct data_urb *pdata_urb;
size_t wMaxPacketSize;
int ISOCwMaxPacketSize;
int BULKwMaxPacketSize;
int INTwMaxPacketSize;
int CTRLwMaxPacketSize;
u8 bEndpointAddress;
u8 ISOCbEndpointAddress;
u8 INTbEndpointAddress;
int isin, i, j, k, m, rc;
u8 bInterfaceNumber;
u8 bInterfaceClass;
u8 bInterfaceSubClass;
void *pbuf;
int okalt[8], isokalt;
int okepn[8];
int okmps[8];
int maxpacketsize;
u16 mask;
s32 value;
struct easycap_format *peasycap_format;
struct usb_device *pusb_device, *pusb_device1;
struct usb_host_interface *pusb_host_interface;
struct usb_endpoint_descriptor *pepd;
struct usb_interface_descriptor *pusb_interface_descriptor;
struct usb_interface_assoc_descriptor *pusb_interface_assoc_descriptor;
struct urb *purb;
struct easycap *peasycap;
int ndong;
struct data_urb *pdata_urb;
size_t wMaxPacketSize;
int ISOCwMaxPacketSize;
int BULKwMaxPacketSize;
int INTwMaxPacketSize;
int CTRLwMaxPacketSize;
u8 bEndpointAddress;
u8 ISOCbEndpointAddress;
u8 INTbEndpointAddress;
int isin, i, j, k, m, rc;
u8 bInterfaceNumber;
u8 bInterfaceClass;
u8 bInterfaceSubClass;
void *pbuf;
int okalt[8], isokalt;
int okepn[8];
int okmps[8];
int maxpacketsize;
u16 mask;
s32 value;
struct easycap_format *peasycap_format;
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#ifdef EASYCAP_IS_VIDEODEV_CLIENT
#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H
struct v4l2_device *pv4l2_device;
struct v4l2_device *pv4l2_device;
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/* setup modules params */
if (NULL == pusb_interface) {
if (NULL == pusb_interface) {
SAY("ERROR: pusb_interface is NULL\n");
return -EFAULT;
}
}
/*---------------------------------------------------------------------------*/
/*
* GET POINTER TO STRUCTURE usb_device
*/
/*---------------------------------------------------------------------------*/
pusb_device1 = container_of(pusb_interface->dev.parent,
pusb_device1 = container_of(pusb_interface->dev.parent,
struct usb_device, dev);
if (NULL == pusb_device1) {
if (NULL == pusb_device1) {
SAY("ERROR: pusb_device1 is NULL\n");
return -EFAULT;
}
pusb_device = usb_get_dev(pusb_device1);
if (NULL == pusb_device) {
}
pusb_device = usb_get_dev(pusb_device1);
if (NULL == pusb_device) {
SAY("ERROR: pusb_device is NULL\n");
return -EFAULT;
}
if ((unsigned long int)pusb_device1 != (unsigned long int)pusb_device) {
}
if ((unsigned long int)pusb_device1 != (unsigned long int)pusb_device) {
JOT(4, "ERROR: pusb_device1 != pusb_device\n");
return -EFAULT;
}
JOT(4, "bNumConfigurations=%i\n", pusb_device->descriptor.bNumConfigurations);
}
JOT(4, "bNumConfigurations=%i\n", pusb_device->descriptor.bNumConfigurations);
/*---------------------------------------------------------------------------*/
pusb_host_interface = pusb_interface->cur_altsetting;
if (NULL == pusb_host_interface) {
pusb_host_interface = pusb_interface->cur_altsetting;
if (NULL == pusb_host_interface) {
SAY("ERROR: pusb_host_interface is NULL\n");
return -EFAULT;
}
pusb_interface_descriptor = &(pusb_host_interface->desc);
if (NULL == pusb_interface_descriptor) {
}
pusb_interface_descriptor = &(pusb_host_interface->desc);
if (NULL == pusb_interface_descriptor) {
SAY("ERROR: pusb_interface_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 = pusb_interface_descriptor->bInterfaceNumber;
bInterfaceClass = pusb_interface_descriptor->bInterfaceClass;
bInterfaceSubClass = pusb_interface_descriptor->bInterfaceSubClass;
JOT(4, "intf[%i]: pusb_interface->num_altsetting=%i\n",
JOT(4, "intf[%i]: pusb_interface->num_altsetting=%i\n",
bInterfaceNumber, pusb_interface->num_altsetting);
JOT(4, "intf[%i]: pusb_interface->cur_altsetting - "
JOT(4, "intf[%i]: pusb_interface->cur_altsetting - "
"pusb_interface->altsetting=%li\n", bInterfaceNumber,
(long int)(pusb_interface->cur_altsetting -
pusb_interface->altsetting));
switch (bInterfaceClass) {
case USB_CLASS_AUDIO: {
switch (bInterfaceClass) {
case USB_CLASS_AUDIO: {
JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_AUDIO\n",
bInterfaceNumber, bInterfaceClass); break;
}
case USB_CLASS_VIDEO: {
case USB_CLASS_VIDEO: {
JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VIDEO\n",
bInterfaceNumber, bInterfaceClass); break;
}
case USB_CLASS_VENDOR_SPEC: {
case USB_CLASS_VENDOR_SPEC: {
JOT(4, "intf[%i]: bInterfaceClass=0x%02X=USB_CLASS_VENDOR_SPEC\n",
bInterfaceNumber, bInterfaceClass); break;
}
default:
default:
break;
}
switch (bInterfaceSubClass) {
case 0x01: {
}
switch (bInterfaceSubClass) {
case 0x01: {
JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOCONTROL\n",
bInterfaceNumber, bInterfaceSubClass); break;
}
case 0x02: {
}
case 0x02: {
JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=AUDIOSTREAMING\n",
bInterfaceNumber, bInterfaceSubClass); break;
}
case 0x03: {
}
case 0x03: {
JOT(4, "intf[%i]: bInterfaceSubClass=0x%02X=MIDISTREAMING\n",
bInterfaceNumber, bInterfaceSubClass); break;
}
default:
}
default:
break;
}
}
/*---------------------------------------------------------------------------*/
pusb_interface_assoc_descriptor = pusb_interface->intf_assoc;
if (NULL != pusb_interface_assoc_descriptor) {
pusb_interface_assoc_descriptor = pusb_interface->intf_assoc;
if (NULL != pusb_interface_assoc_descriptor) {
JOT(4, "intf[%i]: bFirstInterface=0x%02X bInterfaceCount=0x%02X\n",
bInterfaceNumber,
pusb_interface_assoc_descriptor->bFirstInterface,
pusb_interface_assoc_descriptor->bInterfaceCount);
} else {
JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n",
} else {
JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n",
bInterfaceNumber);
}
}
/*---------------------------------------------------------------------------*/
/*
* A NEW struct easycap IS ALWAYS ALLOCATED WHEN INTERFACE 0 IS PROBED.
......@@ -3289,7 +3289,7 @@ JOT(4, "intf[%i]: pusb_interface_assoc_descriptor is NULL\n",
* INTERFACES 1 AND 2 ARE PROBED.
*/
/*---------------------------------------------------------------------------*/
if (0 == bInterfaceNumber) {
if (0 == bInterfaceNumber) {
peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL);
if (NULL == peasycap) {
SAY("ERROR: Could not allocate peasycap\n");
......@@ -3525,7 +3525,7 @@ if (0 == bInterfaceNumber) {
peasycap->inputset[k].input = k;
JOM(4, "populated easycap.inputset[]\n");
JOM(4, "finished initialization\n");
} else {
} else {
/*---------------------------------------------------------------------------*/
/*
* FIXME
......@@ -3579,7 +3579,7 @@ if (0 == bInterfaceNumber) {
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
}
/*---------------------------------------------------------------------------*/
if ((USB_CLASS_VIDEO == bInterfaceClass) ||
if ((USB_CLASS_VIDEO == bInterfaceClass) ||
(USB_CLASS_VENDOR_SPEC == bInterfaceClass)) {
if (-1 == peasycap->video_interface) {
peasycap->video_interface = bInterfaceNumber;
......@@ -3594,7 +3594,7 @@ if ((USB_CLASS_VIDEO == bInterfaceClass) ||
peasycap->video_interface);
}
}
} else if ((USB_CLASS_AUDIO == bInterfaceClass) &&
} else if ((USB_CLASS_AUDIO == bInterfaceClass) &&
(0x02 == bInterfaceSubClass)) {
if (-1 == peasycap->audio_interface) {
peasycap->audio_interface = bInterfaceNumber;
......@@ -3609,16 +3609,16 @@ if ((USB_CLASS_VIDEO == bInterfaceClass) ||
peasycap->audio_interface);
}
}
}
}
/*---------------------------------------------------------------------------*/
/*
* INVESTIGATE ALL ALTSETTINGS.
* DONE IN DETAIL BECAUSE USB DEVICE 05e1:0408 HAS DISPARATE INCARNATIONS.
*/
/*---------------------------------------------------------------------------*/
isokalt = 0;
isokalt = 0;
for (i = 0; i < pusb_interface->num_altsetting; i++) {
for (i = 0; i < pusb_interface->num_altsetting; i++) {
pusb_host_interface = &(pusb_interface->altsetting[i]);
if (NULL == pusb_host_interface) {
SAM("ERROR: pusb_host_interface is NULL\n");
......@@ -3837,21 +3837,21 @@ for (i = 0; i < pusb_interface->num_altsetting; i++) {
bInterfaceNumber, i, j);
}
}
}
}
/*---------------------------------------------------------------------------*/
/*
* PERFORM INITIALIZATION OF THE PROBED INTERFACE
*/
/*---------------------------------------------------------------------------*/
JOM(4, "initialization begins for interface %i\n",
JOM(4, "initialization begins for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber);
switch (bInterfaceNumber) {
switch (bInterfaceNumber) {
/*---------------------------------------------------------------------------*/
/*
* INTERFACE 0 IS THE VIDEO INTERFACE
*/
/*---------------------------------------------------------------------------*/
case 0: {
case 0: {
if (!peasycap) {
SAM("MISTAKE: peasycap is NULL\n");
return -EFAULT;
......@@ -4206,7 +4206,7 @@ case 0: {
* INTERFACE 2 IS THE AUDIO STREAMING INTERFACE
*/
/*--------------------------------------------------------------------------*/
case 1: {
case 1: {
#ifdef EASYCAP_SILENT
return -ENOENT;
#endif /*EASYCAP_SILENT*/
......@@ -4223,9 +4223,9 @@ case 1: {
JOM(4, "no initialization required for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber);
break;
}
/*--------------------------------------------------------------------------*/
case 2: {
}
/*--------------------------------------------------------------------------*/
case 2: {
#ifdef EASYCAP_SILENT
return -ENOENT;
#endif /*EASYCAP_SILENT*/
......@@ -4530,14 +4530,14 @@ case 2: {
* INTERFACES OTHER THAN 0, 1 AND 2 ARE UNEXPECTED
*/
/*---------------------------------------------------------------------------*/
default: {
default: {
JOM(4, "ERROR: unexpected interface %i\n", bInterfaceNumber);
return -EINVAL;
}
}
SAM("ends successfully for interface %i\n",
}
}
SAM("ends successfully for interface %i\n",
pusb_interface_descriptor->bInterfaceNumber);
return 0;
return 0;
}
/*****************************************************************************/
/*---------------------------------------------------------------------------*/
......@@ -4550,50 +4550,50 @@ return 0;
/*---------------------------------------------------------------------------*/
static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
{
struct usb_host_interface *pusb_host_interface;
struct usb_interface_descriptor *pusb_interface_descriptor;
u8 bInterfaceNumber;
struct easycap *peasycap;
struct list_head *plist_head;
struct data_urb *pdata_urb;
int minor, m, kd;
struct usb_host_interface *pusb_host_interface;
struct usb_interface_descriptor *pusb_interface_descriptor;
u8 bInterfaceNumber;
struct easycap *peasycap;
struct list_head *plist_head;
struct data_urb *pdata_urb;
int minor, m, kd;
/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
#ifdef EASYCAP_IS_VIDEODEV_CLIENT
#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H
struct v4l2_device *pv4l2_device;
struct v4l2_device *pv4l2_device;
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
JOT(4, "\n");
JOT(4, "\n");
if (NULL == pusb_interface) {
if (NULL == pusb_interface) {
JOT(4, "ERROR: pusb_interface is NULL\n");
return;
}
pusb_host_interface = pusb_interface->cur_altsetting;
if (NULL == pusb_host_interface) {
}
pusb_host_interface = pusb_interface->cur_altsetting;
if (NULL == pusb_host_interface) {
JOT(4, "ERROR: pusb_host_interface is NULL\n");
return;
}
pusb_interface_descriptor = &(pusb_host_interface->desc);
if (NULL == pusb_interface_descriptor) {
}
pusb_interface_descriptor = &(pusb_host_interface->desc);
if (NULL == pusb_interface_descriptor) {
JOT(4, "ERROR: pusb_interface_descriptor is NULL\n");
return;
}
bInterfaceNumber = pusb_interface_descriptor->bInterfaceNumber;
minor = pusb_interface->minor;
JOT(4, "intf[%i]: minor=%i\n", bInterfaceNumber, minor);
}
bInterfaceNumber = pusb_interface_descriptor->bInterfaceNumber;
minor = pusb_interface->minor;
JOT(4, "intf[%i]: minor=%i\n", bInterfaceNumber, minor);
if (1 == bInterfaceNumber)
if (1 == bInterfaceNumber)
return;
peasycap = usb_get_intfdata(pusb_interface);
if (NULL == peasycap) {
peasycap = usb_get_intfdata(pusb_interface);
if (NULL == peasycap) {
SAY("ERROR: peasycap is NULL\n");
return;
}
}
/*---------------------------------------------------------------------------*/
#ifdef EASYCAP_IS_VIDEODEV_CLIENT
#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H
......@@ -4605,7 +4605,7 @@ if (NULL == peasycap) {
* TO DETECT THIS, THE STRING IN THE easycap.telltale[] BUFFER IS CHECKED.
*/
/*---------------------------------------------------------------------------*/
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
pv4l2_device = usb_get_intfdata(pusb_interface);
if (NULL == pv4l2_device) {
SAY("ERROR: pv4l2_device is NULL\n");
......@@ -4613,28 +4613,28 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
}
peasycap = (struct easycap *)
container_of(pv4l2_device, struct easycap, v4l2_device);
}
}
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*---------------------------------------------------------------------------*/
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
SAY("ERROR: bad peasycap: 0x%08lX\n", (unsigned long int) peasycap);
return;
}
}
/*---------------------------------------------------------------------------*/
/*
* IF THE WAIT QUEUES ARE NOT CLEARED A DEADLOCK IS POSSIBLE. BEWARE.
*/
/*---------------------------------------------------------------------------*/
peasycap->video_eof = 1;
peasycap->audio_eof = 1;
wake_up_interruptible(&(peasycap->wq_video));
wake_up_interruptible(&(peasycap->wq_audio));
peasycap->video_eof = 1;
peasycap->audio_eof = 1;
wake_up_interruptible(&(peasycap->wq_video));
wake_up_interruptible(&(peasycap->wq_audio));
/*---------------------------------------------------------------------------*/
switch (bInterfaceNumber) {
case 0: {
switch (bInterfaceNumber) {
case 0: {
if (NULL != peasycap->purb_video_head) {
JOM(4, "killing video urbs\n");
m = 0;
......@@ -4652,9 +4652,9 @@ case 0: {
JOM(4, "%i video urbs killed\n", m);
}
break;
}
}
/*---------------------------------------------------------------------------*/
case 2: {
case 2: {
if (NULL != peasycap->purb_audio_head) {
JOM(4, "killing audio urbs\n");
m = 0;
......@@ -4672,9 +4672,9 @@ case 2: {
JOM(4, "%i audio urbs killed\n", m);
}
break;
}
}
/*---------------------------------------------------------------------------*/
default:
default:
break;
}
/*--------------------------------------------------------------------------*/
......
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