23 #include <linux/module.h>
24 #include <linux/slab.h>
57 unsigned int max_links = num_pads + extra_links;
60 links = kzalloc(max_links *
sizeof(links[0]),
GFP_KERNEL);
70 entity->
links = links;
72 for (i = 0; i < num_pads; i++) {
95 if (link->
source->entity == entity)
96 return link->
sink->entity;
98 return link->
source->entity;
111 graph->
stack[graph->
top].entity = entity;
118 entity = graph->
stack[graph->
top].entity;
124 #define stack_peek(en) ((en)->stack[(en)->top - 1].entity)
125 #define link_top(en) ((en)->stack[(en)->top].link)
126 #define stack_top(en) ((en)->stack[(en)->top].entity)
143 stack_push(graph, entity);
182 next = media_entity_other(entity, link);
192 stack_push(graph, next);
195 return stack_pop(graph);
240 if (!entity->
ops || !entity->
ops->link_validate)
243 for (i = 0; i < entity->
num_links; i++) {
251 if (link->
sink->entity != entity)
254 ret = entity->
ops->link_validate(link);
280 if (entity_err == entity)
340 if (entity->
parent->dev &&
341 !try_module_get(entity->
parent->dev->driver->owner))
362 module_put(entity->
parent->dev->driver->owner);
374 unsigned int max_links = entity->
max_links + 2;
382 links[i].
reverse->reverse = &links[i];
385 entity->
links = links;
402 link = media_entity_add_link(source);
413 backlink = media_entity_add_link(sink);
414 if (backlink ==
NULL) {
420 backlink->
sink = &sink->
pads[sink_pad];
481 if ((link->
flags & ~mask) != (flags & ~mask))
487 if (link->
flags == flags)
490 source = link->
source->entity;
491 sink = link->
sink->entity;
501 MEDIA_LNK_FL_ENABLED);
506 ret = __media_entity_setup_link_notify(link, flags);
510 if (!(flags & MEDIA_LNK_FL_ENABLED) && mdev->
link_notify)
516 if ((flags & MEDIA_LNK_FL_ENABLED) && mdev->
link_notify)
548 for (i = 0; i < source->
entity->num_links; ++
i) {
549 link = &source->
entity->links[
i];
577 for (i = 0; i < pad->
entity->num_links; i++) {
586 if (link->
sink == pad)