summaryrefslogtreecommitdiffstats
path: root/drivers/media/media-entity.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-08-23 13:00:33 +0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 15:18:53 +0100
commit9155d859b6bec29cdbbd80a509be35de55115f00 (patch)
tree994e634d93e8652cd1105b83ac565d91c21546d4 /drivers/media/media-entity.c
parent[media] media: move mdev list init to gobj (diff)
downloadlinux-9155d859b6bec29cdbbd80a509be35de55115f00.tar.xz
linux-9155d859b6bec29cdbbd80a509be35de55115f00.zip
[media] media-device: add pads and links to media_device
The MC next gen API sends objects to userspace grouped by their types. In the case of pads and links, in order to improve performance and have a simpler code, the best is to store them also on separate linked lists at MC. If we don't do that, we would need this kind of interaction to send data to userspace (code is in structured english): for each entity: for each pad: store pads for each entity: for each link: store link for each interface: for each link: store link With would require one nested loop for pads and two nested loops for links. By using separate linked lists for them, just one loop would be enough. 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.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index b3875b0185c1..2f3d3aae20a7 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -162,13 +162,15 @@ void media_gobj_init(struct media_device *mdev,
break;
case MEDIA_GRAPH_PAD:
gobj->id = media_gobj_gen_id(type, ++mdev->pad_id);
+ list_add_tail(&gobj->list, &mdev->pads);
break;
case MEDIA_GRAPH_LINK:
gobj->id = media_gobj_gen_id(type, ++mdev->link_id);
+ list_add_tail(&gobj->list, &mdev->links);
break;
case MEDIA_GRAPH_INTF_DEVNODE:
- list_add_tail(&gobj->list, &mdev->interfaces);
gobj->id = media_gobj_gen_id(type, ++mdev->intf_devnode_id);
+ list_add_tail(&gobj->list, &mdev->interfaces);
break;
}
dev_dbg_obj(__func__, gobj);
@@ -183,17 +185,10 @@ 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);
+
+ /* Remove the object from mdev list */
+ list_del(&gobj->list);
}
/**