aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_uvc.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-06-12 05:02:38 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-21 10:04:47 -0400
commitb60f9aa1a9fcf69df963c1f06ee0594d836f6760 (patch)
tree1a3b86d5fae708a3572d42cd38b06f39cb18d3f3 /drivers/usb/gadget/f_uvc.c
parenta28fbd04facbffe9374f25c3a19c54ce4f186361 (diff)
[media] f_uvc: add v4l2_device and replace parent with v4l2_dev
This driver did not yet support struct v4l2_device, so add it. This make it possible to replace the deprecated parent field with the v4l2_dev field, allowing the eventual removal of the parent field. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/usb/gadget/f_uvc.c')
-rw-r--r--drivers/usb/gadget/f_uvc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c
index 38dcedddc52c..1d06567ff41e 100644
--- a/drivers/usb/gadget/f_uvc.c
+++ b/drivers/usb/gadget/f_uvc.c
@@ -413,7 +413,7 @@ uvc_register_video(struct uvc_device *uvc)
413 if (video == NULL) 413 if (video == NULL)
414 return -ENOMEM; 414 return -ENOMEM;
415 415
416 video->parent = &cdev->gadget->dev; 416 video->v4l2_dev = &uvc->v4l2_dev;
417 video->fops = &uvc_v4l2_fops; 417 video->fops = &uvc_v4l2_fops;
418 video->release = video_device_release; 418 video->release = video_device_release;
419 strlcpy(video->name, cdev->gadget->name, sizeof(video->name)); 419 strlcpy(video->name, cdev->gadget->name, sizeof(video->name));
@@ -570,6 +570,7 @@ uvc_function_unbind(struct usb_configuration *c, struct usb_function *f)
570 INFO(cdev, "uvc_function_unbind\n"); 570 INFO(cdev, "uvc_function_unbind\n");
571 571
572 video_unregister_device(uvc->vdev); 572 video_unregister_device(uvc->vdev);
573 v4l2_device_unregister(&uvc->v4l2_dev);
573 uvc->control_ep->driver_data = NULL; 574 uvc->control_ep->driver_data = NULL;
574 uvc->video.ep->driver_data = NULL; 575 uvc->video.ep->driver_data = NULL;
575 576
@@ -697,6 +698,11 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
697 if ((ret = usb_function_deactivate(f)) < 0) 698 if ((ret = usb_function_deactivate(f)) < 0)
698 goto error; 699 goto error;
699 700
701 if (v4l2_device_register(&cdev->gadget->dev, &uvc->v4l2_dev)) {
702 printk(KERN_INFO "v4l2_device_register failed\n");
703 goto error;
704 }
705
700 /* Initialise video. */ 706 /* Initialise video. */
701 ret = uvc_video_init(&uvc->video); 707 ret = uvc_video_init(&uvc->video);
702 if (ret < 0) 708 if (ret < 0)
@@ -712,6 +718,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
712 return 0; 718 return 0;
713 719
714error: 720error:
721 v4l2_device_unregister(&uvc->v4l2_dev);
715 if (uvc->vdev) 722 if (uvc->vdev)
716 video_device_release(uvc->vdev); 723 video_device_release(uvc->vdev);
717 724