Thread (3 messages) 3 messages, 2 authors, 2015-09-15

[PATCH v4 2/2] [media] media-device: split media initialization and registration

From: sakari.ailus@linux.intel.com (Sakari Ailus)
Date: 2015-09-15 11:02:38
Also in: linux-media, linux-samsung-soc, linux-sh, lkml

Hi Javier,

Javier Martinez Canillas wrote:
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().

Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <redacted>
Thanks!

For drivers/media/media-device.c, drivers/media/platform/omap3isp/isp.c
and include/media/media-device.h:

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Laurent, could you ack these if you're fine with them?

They depend on Mauro's patches so they should be applied after them.

-- 
Kind regards,

Sakari Ailus
sakari.ailus at linux.intel.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help