diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-08-23 07:51:33 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 12:18:53 -0200 |
commit | 05bfa9fa1cda91953e1b5975b059542b83c5245c (patch) | |
tree | 973b1eaea741c5b5205d263dff055fb02f090dce /drivers/media/media-entity.c | |
parent | cf975a4b40ec9a947dae614b23128f3984a2d324 (diff) | |
download | linux-05bfa9fa1cda91953e1b5975b059542b83c5245c.tar.bz2 |
[media] media: move mdev list init to gobj
Let's control the topology changes inside the graph_object. So, move the
addition and removal of interfaces/entities from the mdev lists to
media_gobj_init() and media_gobj_remove().
The main reason is that mdev should have lists for all object types, as
the new MC api will require to store objects in separate places.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/media-entity.c')
-rw-r--r-- | drivers/media/media-entity.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 5697735be433..b3875b0185c1 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -158,6 +158,7 @@ void media_gobj_init(struct media_device *mdev, switch (type) { case MEDIA_GRAPH_ENTITY: gobj->id = media_gobj_gen_id(type, ++mdev->entity_id); + list_add_tail(&gobj->list, &mdev->entities); break; case MEDIA_GRAPH_PAD: gobj->id = media_gobj_gen_id(type, ++mdev->pad_id); @@ -166,6 +167,7 @@ void media_gobj_init(struct media_device *mdev, gobj->id = media_gobj_gen_id(type, ++mdev->link_id); break; case MEDIA_GRAPH_INTF_DEVNODE: + list_add_tail(&gobj->list, &mdev->interfaces); gobj->id = media_gobj_gen_id(type, ++mdev->intf_devnode_id); break; } @@ -181,6 +183,16 @@ void media_gobj_init(struct media_device *mdev, */ void media_gobj_remove(struct media_gobj *gobj) { + /* Remove the object from mdev list */ + switch (media_type(gobj)) { + case MEDIA_GRAPH_ENTITY: + case MEDIA_GRAPH_INTF_DEVNODE: + list_del(&gobj->list); + break; + default: + break; + } + dev_dbg_obj(__func__, gobj); } @@ -852,8 +864,6 @@ static void media_interface_init(struct media_device *mdev, INIT_LIST_HEAD(&intf->links); media_gobj_init(mdev, gobj_type, &intf->graph_obj); - - list_add_tail(&intf->list, &mdev->interfaces); } /* Functions related to the media interface via device nodes */ @@ -882,7 +892,6 @@ EXPORT_SYMBOL_GPL(media_devnode_create); void media_devnode_remove(struct media_intf_devnode *devnode) { media_gobj_remove(&devnode->intf.graph_obj); - list_del(&devnode->intf.list); kfree(devnode); } EXPORT_SYMBOL_GPL(media_devnode_remove); |