Hi Mauro, On Thursday 09 September 2010 02:46:45 Mauro Carvalho Chehab wrote: > Em 20-08-2010 12:29, Laurent Pinchart escreveu: > > From: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxxxxxxxxxxxxx> > > > > Add media entity graph traversal. The traversal follows active links by > > depth first. Traversing graph backwards is prevented by comparing the > > next possible entity in the graph with the previous one. Multiply > > connected graphs are thus not supported. > > > > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxxxxxxxxxxxxx> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > > Signed-off-by: Vimarsh Zutshi <vimarsh.zutshi@xxxxxxxxx> > > --- > > > > Documentation/media-framework.txt | 40 +++++++++++++ > > drivers/media/media-entity.c | 115 > > +++++++++++++++++++++++++++++++++++++ include/media/media-entity.h > > | 15 +++++ > > 3 files changed, 170 insertions(+), 0 deletions(-) > > > > diff --git a/Documentation/media-framework.txt > > b/Documentation/media-framework.txt index 35d74e4..a599824 100644 > > --- a/Documentation/media-framework.txt > > +++ b/Documentation/media-framework.txt > > @@ -238,3 +238,43 @@ Links have flags that describe the link capabilities > > and state. > > > > MEDIA_LINK_FLAG_ACTIVE must also be set since an immutable link is > > always active. > > > > + > > +Graph traversal > > +--------------- > > + > > +The media framework provides APIs to iterate over entities in a graph. > > + > > +To iterate over all entities belonging to a media device, drivers can > > use the +media_device_for_each_entity macro, defined in > > include/media/media-device.h. + > > + struct media_entity *entity; > > + > > + media_device_for_each_entity(entity, mdev) { > > + /* entity will point to each entity in turn */ > > + ... > > + } > > + > > +Drivers might also need to iterate over all entities in a graph that can > > be +reached only through active links starting at a given entity. The > > media +framework provides a depth-first graph traversal API for that > > purpose. + > > +Note that graphs with cycles (whether directed or undirected) are *NOT* > > +supported by the graph traversal API. > > Please document that a maximum depth exists to prevent loops, currently > defined as 16 (MEDIA_ENTITY_ENUM_MAX_DEPTH). Good idea, will do. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html