[media] media-entity: use mutes for link setup
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 15 Dec 2015 09:58:18 +0000 (07:58 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:19:14 +0000 (12:19 -0200)
Changeset f8fd4c61b5ae ("[media] media-entity: protect object
creation/removal using spin lock") changed the object creation/removal
protection to spin lock, as this is what's used on media-device,
keeping the mutex reserved for graph traversal routines. However, it
also changed the link setup, by mistake.

This could cause troubles, as the link setup can affect the graph
traversal, and this is likely the reason for a mutex there.

So, revert media_entity_setup_link() to use mutex.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-entity.c

index 4822763dcefac294e8ea76196f44b78a10dddfdd..f88740b12879d7311a0c811d07e70d78a4a90181 100644 (file)
@@ -662,9 +662,9 @@ int media_entity_setup_link(struct media_link *link, u32 flags)
 {
        int ret;
 
-       spin_lock(&link->source->entity->graph_obj.mdev->lock);
+       mutex_lock(&link->graph_obj.mdev->graph_mutex);
        ret = __media_entity_setup_link(link, flags);
-       spin_unlock(&link->source->entity->graph_obj.mdev->lock);
+       mutex_unlock(&link->graph_obj.mdev->graph_mutex);
 
        return ret;
 }