path: root/drivers/media/media-entity.c
diff options
authorJavier Martinez Canillas <javier@osg.samsung.com>2015-09-08 14:10:56 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 12:19:02 -0200
commitdb141a355d8914fe80c9e4a6c25c686f64d7e905 (patch)
treeaa41ac6f2918978f5c6f9b645ec5161eea818383 /drivers/media/media-entity.c
parent9033b1a47038fdba388fc13613de23508dccb075 (diff)
[media] media-entity: init pads on entity init if was registered before
If an entity is registered with a media device before is initialized with media_device_register_entity(), the number of pads won't be set so media_device_register_entity() won't create pad objects and add it to the media device pads list. Do this at entity initialization time if the entity was registered before so the graph is complete and correct regardless of the order in which the entities are initialized and registered. Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/media-entity.c')
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 5f61642b2a97..07f2dc6c2df6 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -222,6 +222,7 @@ int
media_entity_init(struct media_entity *entity, u16 num_pads,
struct media_pad *pads)
+ struct media_device *mdev = entity->graph_obj.mdev;
unsigned int i;
entity->group_id = 0;
@@ -230,11 +231,20 @@ media_entity_init(struct media_entity *entity, u16 num_pads,
entity->num_pads = num_pads;
entity->pads = pads;
+ if (mdev)
+ spin_lock(&mdev->lock);
for (i = 0; i < num_pads; i++) {
pads[i].entity = entity;
pads[i].index = i;
+ if (mdev)
+ media_gobj_init(mdev, MEDIA_GRAPH_PAD,
+ &entity->pads[i].graph_obj);
+ if (mdev)
+ spin_unlock(&mdev->lock);
return 0;