aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/uvc/uvc_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/uvc/uvc_driver.c')
-rw-r--r--drivers/media/video/uvc/uvc_driver.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index 823f4b389745..0e8cd1fd870f 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1585,6 +1585,13 @@ static void uvc_delete(struct uvc_device *dev)
1585 uvc_status_cleanup(dev); 1585 uvc_status_cleanup(dev);
1586 uvc_ctrl_cleanup_device(dev); 1586 uvc_ctrl_cleanup_device(dev);
1587 1587
1588 if (dev->vdev.dev)
1589 v4l2_device_unregister(&dev->vdev);
1590#ifdef CONFIG_MEDIA_CONTROLLER
1591 if (media_devnode_is_registered(&dev->mdev.devnode))
1592 media_device_unregister(&dev->mdev);
1593#endif
1594
1588 list_for_each_safe(p, n, &dev->chains) { 1595 list_for_each_safe(p, n, &dev->chains) {
1589 struct uvc_video_chain *chain; 1596 struct uvc_video_chain *chain;
1590 chain = list_entry(p, struct uvc_video_chain, list); 1597 chain = list_entry(p, struct uvc_video_chain, list);
@@ -1682,7 +1689,7 @@ static int uvc_register_video(struct uvc_device *dev,
1682 * unregistered before the reference is released, so we don't need to 1689 * unregistered before the reference is released, so we don't need to
1683 * get another one. 1690 * get another one.
1684 */ 1691 */
1685 vdev->parent = &dev->intf->dev; 1692 vdev->v4l2_dev = &dev->vdev;
1686 vdev->fops = &uvc_fops; 1693 vdev->fops = &uvc_fops;
1687 vdev->release = uvc_release; 1694 vdev->release = uvc_release;
1688 strlcpy(vdev->name, dev->name, sizeof vdev->name); 1695 strlcpy(vdev->name, dev->name, sizeof vdev->name);
@@ -1814,6 +1821,24 @@ static int uvc_probe(struct usb_interface *intf,
1814 "linux-uvc-devel mailing list.\n"); 1821 "linux-uvc-devel mailing list.\n");
1815 } 1822 }
1816 1823
1824 /* Register the media and V4L2 devices. */
1825#ifdef CONFIG_MEDIA_CONTROLLER
1826 dev->mdev.dev = &intf->dev;
1827 strlcpy(dev->mdev.model, dev->name, sizeof(dev->mdev.model));
1828 if (udev->serial)
1829 strlcpy(dev->mdev.serial, udev->serial,
1830 sizeof(dev->mdev.serial));
1831 strcpy(dev->mdev.bus_info, udev->devpath);
1832 dev->mdev.hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
1833 dev->mdev.driver_version = DRIVER_VERSION_NUMBER;
1834 if (media_device_register(&dev->mdev) < 0)
1835 goto error;
1836
1837 dev->vdev.mdev = &dev->mdev;
1838#endif
1839 if (v4l2_device_register(&intf->dev, &dev->vdev) < 0)
1840 goto error;
1841
1817 /* Initialize controls. */ 1842 /* Initialize controls. */
1818 if (uvc_ctrl_init_device(dev) < 0) 1843 if (uvc_ctrl_init_device(dev) < 0)
1819 goto error; 1844 goto error;
@@ -1822,7 +1847,7 @@ static int uvc_probe(struct usb_interface *intf,
1822 if (uvc_scan_device(dev) < 0) 1847 if (uvc_scan_device(dev) < 0)
1823 goto error; 1848 goto error;
1824 1849
1825 /* Register video devices. */ 1850 /* Register video device nodes. */
1826 if (uvc_register_chains(dev) < 0) 1851 if (uvc_register_chains(dev) < 0)
1827 goto error; 1852 goto error;
1828 1853