summaryrefslogtreecommitdiff
path: root/drivers/staging/easycap/easycap_main.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2011-07-05 21:07:47 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-05 19:47:46 -0700
commitcdaa898b5efcc598ab1004e8f913061dc7005091 (patch)
treea5774393834d410a5a4130dcf2ad9d602f1e8b30 /drivers/staging/easycap/easycap_main.c
parentcbbd8a580e67009a7109b5070c9b02b08da92caf (diff)
staging/easycap: kill telltale logic
This reason for this feature was 'some versions of the videodev module overwrite the data which has been written by the call to usb_set_intfdata() in easycap_usb_probe(), replacing it with a pointer to the embedded v4l2_device structure. to detect this, the string in the easycap.telltale[] buffer is checked.' The upstream version of v4l2_device_register sets driver data only when it wasn't already set, therefore this is not needed Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/easycap/easycap_main.c')
-rw-r--r--drivers/staging/easycap/easycap_main.c84
1 files changed, 3 insertions, 81 deletions
diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c
index 84d4f77ef46b..a0299560701c 100644
--- a/drivers/staging/easycap/easycap_main.c
+++ b/drivers/staging/easycap/easycap_main.c
@@ -158,10 +158,6 @@ static int easycap_open(struct inode *inode, struct file *file)
SAY("ERROR: peasycap is NULL\n");
return -EFAULT;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return -EFAULT;
- }
if (!peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT;
@@ -695,10 +691,6 @@ static int videodev_release(struct video_device *pvideo_device)
SAY("ending unsuccessfully\n");
return -EFAULT;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return -EFAULT;
- }
if (0 != kill_video_urbs(peasycap)) {
SAM("ERROR: kill_video_urbs() failed\n");
return -EFAULT;
@@ -736,10 +728,6 @@ static void easycap_delete(struct kref *pkref)
SAM("ERROR: peasycap is NULL: cannot perform deletions\n");
return;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return;
- }
kd = isdongle(peasycap);
/*---------------------------------------------------------------------------*/
/*
@@ -962,10 +950,6 @@ static unsigned int easycap_poll(struct file *file, poll_table *wait)
SAY("ERROR: peasycap is NULL\n");
return -EFAULT;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return -EFAULT;
- }
if (!peasycap->pusb_device) {
SAY("ERROR: peasycap->pusb_device is NULL\n");
return -EFAULT;
@@ -996,11 +980,6 @@ static unsigned int easycap_poll(struct file *file, poll_table *wait)
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
return -ERESTARTSYS;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
- return -ERESTARTSYS;
- }
if (!peasycap->pusb_device) {
SAM("ERROR: peasycap->pusb_device is NULL\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
@@ -2455,10 +2434,6 @@ static void easycap_vma_open(struct vm_area_struct *pvma)
SAY("ERROR: peasycap is NULL\n");
return;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return;
- }
peasycap->vma_many++;
JOT(8, "%i=peasycap->vma_many\n", peasycap->vma_many);
return;
@@ -2473,10 +2448,6 @@ static void easycap_vma_close(struct vm_area_struct *pvma)
SAY("ERROR: peasycap is NULL\n");
return;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return;
- }
peasycap->vma_many--;
JOT(8, "%i=peasycap->vma_many\n", peasycap->vma_many);
return;
@@ -2607,10 +2578,6 @@ static void easycap_complete(struct urb *purb)
SAY("ERROR: easycap_complete(): peasycap is NULL\n");
return;
}
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return;
- }
if (peasycap->video_eof)
return;
for (i = 0; i < VIDEO_ISOC_BUFFER_MANY; i++)
@@ -3001,7 +2968,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
struct easycap_format *peasycap_format;
int fmtidx;
struct inputset *inputset;
- struct v4l2_device *pv4l2_device;
usbdev = interface_to_usbdev(intf);
@@ -3055,7 +3021,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
*/
/*---------------------------------------------------------------------------*/
peasycap->minor = -1;
- strcpy(&peasycap->telltale[0], TELLTALE);
kref_init(&peasycap->kref);
JOM(8, "intf[%i]: after kref_init(..._video) "
"%i=peasycap->kref.refcount.counter\n",
@@ -3268,23 +3233,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
bInterfaceNumber);
return -ENODEV;
}
-/*---------------------------------------------------------------------------*/
-/*
- * SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS
- * BEEN WRITTEN BY THE CALL TO usb_set_intfdata() IN easycap_usb_probe(),
- * REPLACING IT WITH A POINTER TO THE EMBEDDED v4l2_device STRUCTURE.
- * TO DETECT THIS, THE STRING IN THE easycap.telltale[] BUFFER IS CHECKED.
-*/
-/*---------------------------------------------------------------------------*/
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- pv4l2_device = usb_get_intfdata(intf);
- if (!pv4l2_device) {
- SAY("ERROR: pv4l2_device is NULL\n");
- return -ENODEV;
- }
- peasycap = (struct easycap *)
- container_of(pv4l2_device, struct easycap, v4l2_device);
- }
}
/*---------------------------------------------------------------------------*/
if ((USB_CLASS_VIDEO == bInterfaceClass) ||
@@ -3776,14 +3724,12 @@ static int easycap_usb_probe(struct usb_interface *intf,
* THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
*/
/*--------------------------------------------------------------------------*/
- if (0 != (v4l2_device_register(&(intf->dev),
- &(peasycap->v4l2_device)))) {
+ if (v4l2_device_register(&intf->dev, &peasycap->v4l2_device)) {
SAM("v4l2_device_register() failed\n");
return -ENODEV;
- } else {
- JOM(4, "registered device instance: %s\n",
- &(peasycap->v4l2_device.name[0]));
}
+ JOM(4, "registered device instance: %s\n",
+ peasycap->v4l2_device.name);
/*---------------------------------------------------------------------------*/
/*
* FIXME
@@ -4160,7 +4106,6 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
struct list_head *plist_head;
struct data_urb *pdata_urb;
int minor, m, kd;
- struct v4l2_device *pv4l2_device;
JOT(4, "\n");
@@ -4188,29 +4133,6 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
}
/*---------------------------------------------------------------------------*/
/*
- * SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS
- * BEEN WRITTEN BY THE CALL TO usb_set_intfdata() IN easycap_usb_probe(),
- * REPLACING IT WITH A POINTER TO THE EMBEDDED v4l2_device STRUCTURE.
- * TO DETECT THIS, THE STRING IN THE easycap.telltale[] BUFFER IS CHECKED.
-*/
-/*---------------------------------------------------------------------------*/
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- pv4l2_device = usb_get_intfdata(pusb_interface);
- if (!pv4l2_device) {
- SAY("ERROR: pv4l2_device is NULL\n");
- return;
- }
- peasycap = (struct easycap *)
- container_of(pv4l2_device, struct easycap, v4l2_device);
- }
-/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
-/*---------------------------------------------------------------------------*/
- if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
- SAY("ERROR: bad peasycap: %p\n", peasycap);
- return;
- }
-/*---------------------------------------------------------------------------*/
-/*
* IF THE WAIT QUEUES ARE NOT CLEARED A DEADLOCK IS POSSIBLE. BEWARE.
*/
/*---------------------------------------------------------------------------*/