Lines Matching refs:graph

102 static void stack_push(struct media_entity_graph *graph,
105 if (graph->top == MEDIA_ENTITY_ENUM_MAX_DEPTH - 1) {
109 graph->top++;
110 graph->stack[graph->top].link = 0;
111 graph->stack[graph->top].entity = entity;
114 static struct media_entity *stack_pop(struct media_entity_graph *graph)
118 entity = graph->stack[graph->top].entity;
119 graph->top--;
129 * media_entity_graph_walk_start - Start walking the media graph at a given entity
130 * @graph: Media graph structure that will be used to walk the graph
133 * This function initializes the graph traversal structure to walk the entities
134 * graph starting at the given entity. The traversal structure must not be
135 * modified by the caller during graph traversal. When done the structure can
138 void media_entity_graph_walk_start(struct media_entity_graph *graph,
141 graph->top = 0;
142 graph->stack[graph->top].entity = NULL;
143 stack_push(graph, entity);
148 * media_entity_graph_walk_next - Get the next entity in the graph
149 * @graph: Media graph structure
151 * Perform a depth-first traversal of the given media entities graph.
153 * The graph structure must have been previously initialized with a call to
156 * Return the next entity in the graph or NULL if the whole graph have been
160 media_entity_graph_walk_next(struct media_entity_graph *graph)
162 if (stack_top(graph) == NULL)
170 while (link_top(graph) < stack_top(graph)->num_links) {
171 struct media_entity *entity = stack_top(graph);
172 struct media_link *link = &entity->links[link_top(graph)];
177 link_top(graph)++;
185 if (next == stack_peek(graph)) {
186 link_top(graph)++;
191 link_top(graph)++;
192 stack_push(graph, next);
195 return stack_pop(graph);
221 struct media_entity_graph graph;
225 media_entity_graph_walk_start(&graph, entity);
227 while ((entity = media_entity_graph_walk_next(&graph))) {
252 struct media_entity_graph graph;
256 media_entity_graph_walk_start(&graph, entity);
258 while ((entity = media_entity_graph_walk_next(&graph))) {
357 /* Create the backlink. Backlinks are used to help graph traversal and