diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2015-12-16 11:32:28 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 12:19:20 -0200 |
commit | 29d8da02d13020a18929a30692d454bd863d4207 (patch) | |
tree | ede2bbe080db7dd2a0a35fcc61c6b5bd62d90427 /drivers/media/media-entity.c | |
parent | c1a5f1bc0b7a585efaeda40c1eb8f5f4bd9d328d (diff) | |
download | linux-29d8da02d13020a18929a30692d454bd863d4207.tar.gz linux-29d8da02d13020a18929a30692d454bd863d4207.tar.bz2 linux-29d8da02d13020a18929a30692d454bd863d4207.zip |
[media] media: Use entity enums in graph walk
This will also mean that the necessary graph related data structures will
be allocated dynamically, removing the need for maximum ID checks.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.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 | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 85af715d2a20..86a8396f6ec2 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -296,7 +296,7 @@ static struct media_entity *stack_pop(struct media_entity_graph *graph) __must_check int media_entity_graph_walk_init( struct media_entity_graph *graph, struct media_device *mdev) { - return 0; + return media_entity_enum_init(&graph->ent_enum, mdev); } EXPORT_SYMBOL_GPL(media_entity_graph_walk_init); @@ -306,20 +306,18 @@ EXPORT_SYMBOL_GPL(media_entity_graph_walk_init); */ void media_entity_graph_walk_cleanup(struct media_entity_graph *graph) { + media_entity_enum_cleanup(&graph->ent_enum); } EXPORT_SYMBOL_GPL(media_entity_graph_walk_cleanup); void media_entity_graph_walk_start(struct media_entity_graph *graph, struct media_entity *entity) { + media_entity_enum_zero(&graph->ent_enum); + media_entity_enum_set(&graph->ent_enum, entity); + graph->top = 0; graph->stack[graph->top].entity = NULL; - bitmap_zero(graph->entities, MEDIA_ENTITY_ENUM_MAX_ID); - - if (WARN_ON(media_entity_id(entity) >= MEDIA_ENTITY_ENUM_MAX_ID)) - return; - - __set_bit(media_entity_id(entity), graph->entities); stack_push(graph, entity); } EXPORT_SYMBOL_GPL(media_entity_graph_walk_start); @@ -350,11 +348,9 @@ media_entity_graph_walk_next(struct media_entity_graph *graph) /* Get the entity in the other end of the link . */ next = media_entity_other(entity, link); - if (WARN_ON(media_entity_id(next) >= MEDIA_ENTITY_ENUM_MAX_ID)) - return NULL; /* Has the entity already been visited? */ - if (__test_and_set_bit(media_entity_id(next), graph->entities)) { + if (media_entity_enum_test_and_set(&graph->ent_enum, next)) { link_top(graph) = link_top(graph)->next; continue; } |