提交 a12ca6a6 编写于 作者: J Jean-Francois Moine 提交者: Mauro Carvalho Chehab

V4L/DVB (9691): gspca: Some cleanups at device register

Signed-off-by: NJean-Francois Moine <moinejf@free.fr>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 3c92ec8a
...@@ -862,7 +862,7 @@ static int dev_open(struct inode *inode, struct file *file) ...@@ -862,7 +862,7 @@ static int dev_open(struct inode *inode, struct file *file)
int ret; int ret;
PDEBUG(D_STREAM, "%s open", current->comm); PDEBUG(D_STREAM, "%s open", current->comm);
gspca_dev = video_drvdata(file); gspca_dev = (struct gspca_dev *) video_devdata(file);
if (mutex_lock_interruptible(&gspca_dev->queue_lock)) if (mutex_lock_interruptible(&gspca_dev->queue_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
if (!gspca_dev->present) { if (!gspca_dev->present) {
...@@ -890,10 +890,10 @@ static int dev_open(struct inode *inode, struct file *file) ...@@ -890,10 +890,10 @@ static int dev_open(struct inode *inode, struct file *file)
#ifdef GSPCA_DEBUG #ifdef GSPCA_DEBUG
/* activate the v4l2 debug */ /* activate the v4l2 debug */
if (gspca_debug & D_V4L2) if (gspca_debug & D_V4L2)
gspca_dev->vdev->debug |= V4L2_DEBUG_IOCTL gspca_dev->vdev.debug |= V4L2_DEBUG_IOCTL
| V4L2_DEBUG_IOCTL_ARG; | V4L2_DEBUG_IOCTL_ARG;
else else
gspca_dev->vdev->debug &= ~(V4L2_DEBUG_IOCTL gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL
| V4L2_DEBUG_IOCTL_ARG); | V4L2_DEBUG_IOCTL_ARG);
#endif #endif
ret = 0; ret = 0;
...@@ -1876,13 +1876,11 @@ int gspca_dev_probe(struct usb_interface *intf, ...@@ -1876,13 +1876,11 @@ int gspca_dev_probe(struct usb_interface *intf,
gspca_dev->vdev->parent = &dev->dev; gspca_dev->vdev->parent = &dev->dev;
gspca_dev->module = module; gspca_dev->module = module;
gspca_dev->present = 1; gspca_dev->present = 1;
video_set_drvdata(gspca_dev->vdev, gspca_dev); ret = video_register_device(&gspca_dev->vdev,
ret = video_register_device(gspca_dev->vdev,
VFL_TYPE_GRABBER, VFL_TYPE_GRABBER,
video_nr); video_nr);
if (ret < 0) { if (ret < 0) {
err("video_register_device err %d", ret); err("video_register_device err %d", ret);
video_device_release(gspca_dev->vdev);
goto out; goto out;
} }
...@@ -1908,11 +1906,9 @@ void gspca_disconnect(struct usb_interface *intf) ...@@ -1908,11 +1906,9 @@ void gspca_disconnect(struct usb_interface *intf)
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
/* We don't want people trying to open up the device */ /* release the device */
video_unregister_device(gspca_dev->vdev); /* (this will call gspca_release() immediatly or on last close) */
video_unregister_device(&gspca_dev->vdev);
gspca_dev->present = 0;
gspca_dev->streaming = 0;
kref_put(&gspca_dev->kref, gspca_delete); kref_put(&gspca_dev->kref, gspca_delete);
......
...@@ -120,7 +120,7 @@ struct gspca_frame { ...@@ -120,7 +120,7 @@ struct gspca_frame {
}; };
struct gspca_dev { struct gspca_dev {
struct video_device *vdev; struct video_device vdev; /* !! must be the first item */
struct module *module; /* subdriver handling the device */ struct module *module; /* subdriver handling the device */
struct usb_device *dev; struct usb_device *dev;
struct kref kref; struct kref kref;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册