diff options
-rw-r--r-- | drivers/media/media-entity.c | 27 | ||||
-rw-r--r-- | include/media/media-entity.h | 17 |
2 files changed, 39 insertions, 5 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 83cfde6dcb1c..9bf96c71374e 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c | |||
@@ -282,6 +282,33 @@ static struct media_entity *stack_pop(struct media_entity_graph *graph) | |||
282 | #define link_top(en) ((en)->stack[(en)->top].link) | 282 | #define link_top(en) ((en)->stack[(en)->top].link) |
283 | #define stack_top(en) ((en)->stack[(en)->top].entity) | 283 | #define stack_top(en) ((en)->stack[(en)->top].entity) |
284 | 284 | ||
285 | /** | ||
286 | * media_entity_graph_walk_init - Allocate resources for graph walk | ||
287 | * @graph: Media graph structure that will be used to walk the graph | ||
288 | * @mdev: Media device | ||
289 | * | ||
290 | * Reserve resources for graph walk in media device's current | ||
291 | * state. The memory must be released using | ||
292 | * media_entity_graph_walk_free(). | ||
293 | * | ||
294 | * Returns error on failure, zero on success. | ||
295 | */ | ||
296 | __must_check int media_entity_graph_walk_init( | ||
297 | struct media_entity_graph *graph, struct media_device *mdev) | ||
298 | { | ||
299 | return 0; | ||
300 | } | ||
301 | EXPORT_SYMBOL_GPL(media_entity_graph_walk_init); | ||
302 | |||
303 | /** | ||
304 | * media_entity_graph_walk_cleanup - Release resources related to graph walking | ||
305 | * @graph: Media graph structure that was used to walk the graph | ||
306 | */ | ||
307 | void media_entity_graph_walk_cleanup(struct media_entity_graph *graph) | ||
308 | { | ||
309 | } | ||
310 | EXPORT_SYMBOL_GPL(media_entity_graph_walk_cleanup); | ||
311 | |||
285 | void media_entity_graph_walk_start(struct media_entity_graph *graph, | 312 | void media_entity_graph_walk_start(struct media_entity_graph *graph, |
286 | struct media_entity *entity) | 313 | struct media_entity *entity) |
287 | { | 314 | { |
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 |