linux/drivers/media/usb/uvc
Javier Martinez Canillas 9832e155f1 [media] media-device: split media initialization and registration
The media device node is registered and so made visible to user-space
before entities are registered and links created which means that the
media graph obtained by user-space could be only partially enumerated
if that happens too early before all the graph has been created.

To avoid this race condition, split the media init and registration
in separate functions and only register the media device node when
all the pending subdevices have been registered, either explicitly
by the driver or asynchronously using v4l2_async_register_subdev().

The media_device_register() had a check for drivers not filling dev
and model fields but all drivers in mainline set them and not doing
it will be a driver bug so change the function return to void and
add a BUG_ON() for dev being NULL instead.

Also, add a media_device_cleanup() function that will destroy the
graph_mutex that is initialized in media_device_init().

[mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER
 and remove two warnings added by this changeset]
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:19:15 -02:00
..
Kconfig [media] uvc: Depend on VIDEO_V4L2 2013-06-24 22:54:40 -03:00
Makefile
uvc_ctrl.c [media] uvcvideo: Fix reading the current exposure value of UVC 2015-12-18 15:21:34 -02:00
uvc_debugfs.c
uvc_driver.c [media] media-device: split media initialization and registration 2016-01-11 12:19:15 -02:00
uvc_entity.c [media] uvcvideo: register entity subdev on init 2016-01-11 12:19:09 -02:00
uvc_isight.c
uvc_queue.c [media] vb2: drop v4l2_format argument from queue_setup 2015-12-18 13:48:19 -02:00
uvc_status.c [media] uvcvideo: Fix open/close race condition 2013-06-08 19:51:16 -03:00
uvc_v4l2.c [media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL 2015-11-17 14:46:21 -02:00
uvc_video.c [media] uvcvideo: small cleanup in uvc_video_clock_update() 2015-12-18 15:21:35 -02:00
uvcvideo.h Revert "[media] UVC: Add support for ds4 depth camera" 2015-12-12 08:10:40 -02:00