diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-02-04 12:17:42 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-05 18:38:10 +0100 |
commit | 968c60f60376a573460b6ef4991435d09528d48c (patch) | |
tree | 4e2725a912cad7f7611314ec9f99ca80ab7936a9 /drivers/media/usb/stkwebcam | |
parent | [media] stk-webcam: remove bogus STD support (diff) | |
download | linux-968c60f60376a573460b6ef4991435d09528d48c.tar.xz linux-968c60f60376a573460b6ef4991435d09528d48c.zip |
[media] stk-webcam: add support for struct v4l2_device
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/stkwebcam')
-rw-r--r-- | drivers/media/usb/stkwebcam/stk-webcam.c | 10 | ||||
-rw-r--r-- | drivers/media/usb/stkwebcam/stk-webcam.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index e9dbe23122c3..eaf152c51ae2 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -1294,7 +1294,7 @@ static int stk_register_video_device(struct stk_camera *dev) dev->vdev = stk_v4l_data; dev->vdev.debug = debug; - dev->vdev.parent = &dev->interface->dev; + dev->vdev.v4l2_dev = &dev->v4l2_dev; err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1); if (err) STK_ERROR("v4l registration failed\n"); @@ -1323,6 +1323,12 @@ static int stk_camera_probe(struct usb_interface *interface, STK_ERROR("Out of memory !\n"); return -ENOMEM; } + err = v4l2_device_register(&interface->dev, &dev->v4l2_dev); + if (err < 0) { + dev_err(&udev->dev, "couldn't register v4l2_device\n"); + kfree(dev); + return err; + } spin_lock_init(&dev->spinlock); init_waitqueue_head(&dev->wait_frame); @@ -1383,6 +1389,7 @@ static int stk_camera_probe(struct usb_interface *interface, return 0; error: + v4l2_device_unregister(&dev->v4l2_dev); kfree(dev); return err; } @@ -1400,6 +1407,7 @@ static void stk_camera_disconnect(struct usb_interface *interface) video_device_node_name(&dev->vdev)); video_unregister_device(&dev->vdev); + v4l2_device_unregister(&dev->v4l2_dev); } #ifdef CONFIG_PM diff --git a/drivers/media/usb/stkwebcam/stk-webcam.h b/drivers/media/usb/stkwebcam/stk-webcam.h index 9f6736637571..49ebe855cba6 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.h +++ b/drivers/media/usb/stkwebcam/stk-webcam.h @@ -23,6 +23,7 @@ #define STKWEBCAM_H #include <linux/usb.h> +#include <media/v4l2-device.h> #include <media/v4l2-common.h> #define DRIVER_VERSION "v0.0.1" @@ -91,6 +92,7 @@ struct regval { }; struct stk_camera { + struct v4l2_device v4l2_dev; struct video_device vdev; struct usb_device *udev; struct usb_interface *interface; |