aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/go7007/go7007-v4l2.c
diff options
context:
space:
mode:
authorPete Eberlein <pete@sensoray.com>2009-11-16 15:07:42 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 18:42:00 -0200
commit0b398f4f124e2b4b03f9acf726370c8459610c5c (patch)
treee391f4794df042eb50f228663d9df720adc1db60 /drivers/staging/go7007/go7007-v4l2.c
parentV4L/DVB (13453): gspca - all subdrivers: Remove the unused frame ptr from pkt_scan(). (diff)
downloadlinux-dev-0b398f4f124e2b4b03f9acf726370c8459610c5c.tar.xz
linux-dev-0b398f4f124e2b4b03f9acf726370c8459610c5c.zip
V4L/DVB (13455): go7007: Add struct v4l2_device.
This adds a struct v4l2_device to the go7007 device struct and registers it during v4l2 initialization. The v4l2_device registration overwrites the go->dev device_data, which is a struct usb_interface with intfdata set to the struct go7007. This changes intfdata to point to the struct v4l2_device inside struct go7007, which is what v4l2_device_register will also set it to (and warn about non-null drvdata on register.) Since usb disconnect can happen any time, this intfdata should always be present. Signed-off-by: Pete Eberlein <pete@sensoray.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging/go7007/go7007-v4l2.c')
-rw-r--r--drivers/staging/go7007/go7007-v4l2.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/staging/go7007/go7007-v4l2.c b/drivers/staging/go7007/go7007-v4l2.c
index 4bd353afa596..faa749dd0356 100644
--- a/drivers/staging/go7007/go7007-v4l2.c
+++ b/drivers/staging/go7007/go7007-v4l2.c
@@ -1827,7 +1827,7 @@ int go7007_v4l2_init(struct go7007 *go)
go->video_dev = video_device_alloc();
if (go->video_dev == NULL)
return -ENOMEM;
- memcpy(go->video_dev, &go7007_template, sizeof(go7007_template));
+ *go->video_dev = go7007_template;
go->video_dev->parent = go->dev;
rv = video_register_device(go->video_dev, VFL_TYPE_GRABBER, -1);
if (rv < 0) {
@@ -1835,6 +1835,12 @@ int go7007_v4l2_init(struct go7007 *go)
go->video_dev = NULL;
return rv;
}
+ rv = v4l2_device_register(go->dev, &go->v4l2_dev);
+ if (rv < 0) {
+ video_device_release(go->video_dev);
+ go->video_dev = NULL;
+ return rv;
+ }
video_set_drvdata(go->video_dev, go);
++go->ref_count;
printk(KERN_INFO "%s: registered device video%d [v4l2]\n",
@@ -1858,4 +1864,5 @@ void go7007_v4l2_remove(struct go7007 *go)
mutex_unlock(&go->hw_lock);
if (go->video_dev)
video_unregister_device(go->video_dev);
+ v4l2_device_unregister(&go->v4l2_dev);
}