aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-11-19 04:37:53 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:12 -0500
commita12ca6a6e143d77557772139f660121dfea6e923 (patch)
treeb359e080763bbd374bcb29987f619c09435d4720 /drivers/media/video/gspca/gspca.c
parent3c92ec8ae91ecf59d88c798301833d7cf83f2179 (diff)
V4L/DVB (9691): gspca: Some cleanups at device register
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 02a6e9ef0337..6e23fd4a203f 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -862,7 +862,7 @@ static int dev_open(struct inode *inode, struct file *file)
862 int ret; 862 int ret;
863 863
864 PDEBUG(D_STREAM, "%s open", current->comm); 864 PDEBUG(D_STREAM, "%s open", current->comm);
865 gspca_dev = video_drvdata(file); 865 gspca_dev = (struct gspca_dev *) video_devdata(file);
866 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 866 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
867 return -ERESTARTSYS; 867 return -ERESTARTSYS;
868 if (!gspca_dev->present) { 868 if (!gspca_dev->present) {
@@ -890,10 +890,10 @@ static int dev_open(struct inode *inode, struct file *file)
890#ifdef GSPCA_DEBUG 890#ifdef GSPCA_DEBUG
891 /* activate the v4l2 debug */ 891 /* activate the v4l2 debug */
892 if (gspca_debug & D_V4L2) 892 if (gspca_debug & D_V4L2)
893 gspca_dev->vdev->debug |= V4L2_DEBUG_IOCTL 893 gspca_dev->vdev.debug |= V4L2_DEBUG_IOCTL
894 | V4L2_DEBUG_IOCTL_ARG; 894 | V4L2_DEBUG_IOCTL_ARG;
895 else 895 else
896 gspca_dev->vdev->debug &= ~(V4L2_DEBUG_IOCTL 896 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL
897 | V4L2_DEBUG_IOCTL_ARG); 897 | V4L2_DEBUG_IOCTL_ARG);
898#endif 898#endif
899 ret = 0; 899 ret = 0;
@@ -1876,13 +1876,11 @@ int gspca_dev_probe(struct usb_interface *intf,
1876 gspca_dev->vdev->parent = &dev->dev; 1876 gspca_dev->vdev->parent = &dev->dev;
1877 gspca_dev->module = module; 1877 gspca_dev->module = module;
1878 gspca_dev->present = 1; 1878 gspca_dev->present = 1;
1879 video_set_drvdata(gspca_dev->vdev, gspca_dev); 1879 ret = video_register_device(&gspca_dev->vdev,
1880 ret = video_register_device(gspca_dev->vdev,
1881 VFL_TYPE_GRABBER, 1880 VFL_TYPE_GRABBER,
1882 video_nr); 1881 video_nr);
1883 if (ret < 0) { 1882 if (ret < 0) {
1884 err("video_register_device err %d", ret); 1883 err("video_register_device err %d", ret);
1885 video_device_release(gspca_dev->vdev);
1886 goto out; 1884 goto out;
1887 } 1885 }
1888 1886
@@ -1908,11 +1906,9 @@ void gspca_disconnect(struct usb_interface *intf)
1908 1906
1909 usb_set_intfdata(intf, NULL); 1907 usb_set_intfdata(intf, NULL);
1910 1908
1911/* We don't want people trying to open up the device */ 1909 /* release the device */
1912 video_unregister_device(gspca_dev->vdev); 1910 /* (this will call gspca_release() immediatly or on last close) */
1913 1911 video_unregister_device(&gspca_dev->vdev);
1914 gspca_dev->present = 0;
1915 gspca_dev->streaming = 0;
1916 1912
1917 kref_put(&gspca_dev->kref, gspca_delete); 1913 kref_put(&gspca_dev->kref, gspca_delete);
1918 1914