mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[media] media: Add support for circular graph traversal
The graph traversal API (media_entity_graph_walk_*) doesn't support cyclic graphs and will fail to correctly walk a graph when circular links exist. Support circular graph traversal by checking whether an entity has already been visited before pushing it to the stack. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Sakari Ailus <[email protected]> Acked-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
parent
3a9677063f
commit
5c7b25b90d
2 changed files with 15 additions and 3 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#ifndef _MEDIA_ENTITY_H
|
||||
#define _MEDIA_ENTITY_H
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/media.h>
|
||||
|
||||
|
|
@ -113,12 +114,15 @@ static inline u32 media_entity_subtype(struct media_entity *entity)
|
|||
}
|
||||
|
||||
#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
|
||||
#define MEDIA_ENTITY_ENUM_MAX_ID 64
|
||||
|
||||
struct media_entity_graph {
|
||||
struct {
|
||||
struct media_entity *entity;
|
||||
int link;
|
||||
} stack[MEDIA_ENTITY_ENUM_MAX_DEPTH];
|
||||
|
||||
DECLARE_BITMAP(entities, MEDIA_ENTITY_ENUM_MAX_ID);
|
||||
int top;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue