diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-06-07 11:45:11 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-18 06:16:48 -0400 |
commit | 5c7b25b90d36942c524d06522ebaf0510a75592a (patch) | |
tree | 979e3f88bf6e507021c28ac3e9236f7d5cc3bfa9 /include/media/media-entity.h | |
parent | 3a9677063f00a61b6067a07df3d7ee12eace79b7 (diff) |
[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 <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include/media/media-entity.h')
-rw-r--r-- | include/media/media-entity.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 06bacf937d61..10df55187981 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #ifndef _MEDIA_ENTITY_H | 23 | #ifndef _MEDIA_ENTITY_H |
24 | #define _MEDIA_ENTITY_H | 24 | #define _MEDIA_ENTITY_H |
25 | 25 | ||
26 | #include <linux/bitops.h> | ||
26 | #include <linux/list.h> | 27 | #include <linux/list.h> |
27 | #include <linux/media.h> | 28 | #include <linux/media.h> |
28 | 29 | ||
@@ -113,12 +114,15 @@ static inline u32 media_entity_subtype(struct media_entity *entity) | |||
113 | } | 114 | } |
114 | 115 | ||
115 | #define MEDIA_ENTITY_ENUM_MAX_DEPTH 16 | 116 | #define MEDIA_ENTITY_ENUM_MAX_DEPTH 16 |
117 | #define MEDIA_ENTITY_ENUM_MAX_ID 64 | ||
116 | 118 | ||
117 | struct media_entity_graph { | 119 | struct media_entity_graph { |
118 | struct { | 120 | struct { |
119 | struct media_entity *entity; | 121 | struct media_entity *entity; |
120 | int link; | 122 | int link; |
121 | } stack[MEDIA_ENTITY_ENUM_MAX_DEPTH]; | 123 | } stack[MEDIA_ENTITY_ENUM_MAX_DEPTH]; |
124 | |||
125 | DECLARE_BITMAP(entities, MEDIA_ENTITY_ENUM_MAX_ID); | ||
122 | int top; | 126 | int top; |
123 | }; | 127 | }; |
124 | 128 | ||