[media] media-device: supress backlinks at G_TOPOLOGY ioctl
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Sun, 30 Aug 2015 12:53:57 +0000 (09:53 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:18:58 +0000 (12:18 -0200)
Due to the graph traversal algorithm currently in usage, we
need a copy of all data links. Those backlinks should not be
send to userspace, as otherwise, all links there will be
duplicated.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-device.c
drivers/media/media-entity.c
include/media/media-entity.h

index c7d97190a67e3a0eb7f8ff972c2e991803ede597..30cef8740afaaa7106c89b2f91887783aa0d3a5a 100644 (file)
@@ -333,6 +333,9 @@ static long __media_device_get_topology(struct media_device *mdev,
        /* Get links and number of links */
        i = 0;
        media_device_for_each_link(link, mdev) {
+               if (link->is_backlink)
+                       continue;
+
                i++;
 
                if (ret || !topo->links)
index d9d42fab22ad2878df885879c0bce77a35d47d09..246d7e65adedbf363fd3f0aa3c8ca43fd34ab6df 100644 (file)
@@ -625,6 +625,7 @@ media_create_pad_link(struct media_entity *source, u16 source_pad,
        backlink->source = &source->pads[source_pad];
        backlink->sink = &sink->pads[sink_pad];
        backlink->flags = flags;
+       backlink->is_backlink = true;
 
        /* Initialize graph object embedded at the new link */
        media_gobj_init(sink->graph_obj.mdev, MEDIA_GRAPH_LINK,
index fd19aecdcbb6428e891b75c4432132d4ee5e6e7a..3b591d72c70335b70f8e7f8784afc3da2e55be0f 100644 (file)
@@ -96,6 +96,7 @@ struct media_pipeline {
  * @reverse:   Pointer to the link for the reverse direction of a pad to pad
  *             link.
  * @flags:     Link flags, as defined in uapi/media.h (MEDIA_LNK_FL_*)
+ * @is_backlink: Indicate if the link is a backlink.
  */
 struct media_link {
        struct media_gobj graph_obj;
@@ -112,6 +113,7 @@ struct media_link {
        };
        struct media_link *reverse;
        unsigned long flags;
+       bool is_backlink;
 };
 
 /**
This page took 0.037488 seconds and 5 git commands to generate.