summaryrefslogtreecommitdiff
path: root/drivers/media/media-device.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-08-14 12:54:36 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 12:18:42 -0200
commit6b6a42780597028135f82c96e42c6d2bcd83fbae (patch)
tree36121532964b98be43ad2afe041d1cd0a54a63eb /drivers/media/media-device.c
parent18710dc67a433ed2c3ecaaffefd8e34502e53262 (diff)
[media] media: use media_gobj inside links
Just like entities and pads, links also need to have unique Object IDs along a given media controller. So, let's add a media_gobj inside it and initialize the object then a new link is created. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Tested-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/media-device.c')
-rw-r--r--drivers/media/media-device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 3bdda16584fe..065f6f08da37 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -438,6 +438,13 @@ int __must_check media_device_register_entity(struct media_device *mdev,
media_gobj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
list_add_tail(&entity->list, &mdev->entities);
+ /*
+ * Initialize objects at the links
+ * in the case where links got created before entity register
+ */
+ for (i = 0; i < entity->num_links; i++)
+ media_gobj_init(mdev, MEDIA_GRAPH_LINK,
+ &entity->links[i].graph_obj);
/* Initialize objects at the pads */
for (i = 0; i < entity->num_pads; i++)
media_gobj_init(mdev, MEDIA_GRAPH_PAD,
@@ -465,6 +472,8 @@ void media_device_unregister_entity(struct media_entity *entity)
return;
spin_lock(&mdev->lock);
+ for (i = 0; i < entity->num_links; i++)
+ media_gobj_remove(&entity->links[i].graph_obj);
for (i = 0; i < entity->num_pads; i++)
media_gobj_remove(&entity->pads[i].graph_obj);
media_gobj_remove(&entity->graph_obj);