diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2015-12-16 08:32:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 09:19:18 -0500 |
commit | e03d220336dd69292370393f5eee98ac17eda308 (patch) | |
tree | 2815c164379aca3f8b937a5c44d3799b6b5d2f7d /include/media/media-entity.h | |
parent | 5dd8775dc6b480f67be11108d7cd798fba724cab (diff) |
[media] media: Amend media graph walk API by init and cleanup functions
Add media_entity_graph_walk_init() and media_entity_graph_walk_cleanup()
functions in order to dynamically allocate memory for the graph. This is
not done in media_entity_graph_walk_start() as there are situations where
e.g. correct error handling, that itself may not fail, requires successful
graph walk.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'include/media/media-entity.h')
-rw-r--r-- | include/media/media-entity.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 4dc3bef72c9d..7f028ea84911 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h | |||
@@ -699,6 +699,10 @@ struct media_pad *media_entity_remote_pad(struct media_pad *pad); | |||
699 | */ | 699 | */ |
700 | struct media_entity *media_entity_get(struct media_entity *entity); | 700 | struct media_entity *media_entity_get(struct media_entity *entity); |
701 | 701 | ||
702 | __must_check int media_entity_graph_walk_init( | ||
703 | struct media_entity_graph *graph, struct media_device *mdev); | ||
704 | void media_entity_graph_walk_cleanup(struct media_entity_graph *graph); | ||
705 | |||
702 | /** | 706 | /** |
703 | * media_entity_put - Release the reference to the parent module | 707 | * media_entity_put - Release the reference to the parent module |
704 | * | 708 | * |
@@ -715,13 +719,16 @@ void media_entity_put(struct media_entity *entity); | |||
715 | * @graph: Media graph structure that will be used to walk the graph | 719 | * @graph: Media graph structure that will be used to walk the graph |
716 | * @entity: Starting entity | 720 | * @entity: Starting entity |
717 | * | 721 | * |
718 | * This function initializes the graph traversal structure to walk the entities | 722 | * Before using this function, media_entity_graph_walk_init() must be |
719 | * graph starting at the given entity. The traversal structure must not be | 723 | * used to allocate resources used for walking the graph. This |
720 | * modified by the caller during graph traversal. When done the structure can | 724 | * function initializes the graph traversal structure to walk the |
721 | * safely be freed. | 725 | * entities graph starting at the given entity. The traversal |
726 | * structure must not be modified by the caller during graph | ||
727 | * traversal. After the graph walk, the resources must be released | ||
728 | * using media_entity_graph_walk_cleanup(). | ||
722 | */ | 729 | */ |
723 | void media_entity_graph_walk_start(struct media_entity_graph *graph, | 730 | void media_entity_graph_walk_start(struct media_entity_graph *graph, |
724 | struct media_entity *entity); | 731 | struct media_entity *entity); |
725 | 732 | ||
726 | /** | 733 | /** |
727 | * media_entity_graph_walk_next - Get the next entity in the graph | 734 | * media_entity_graph_walk_next - Get the next entity in the graph |