Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39d1ebc6 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

[media] media-device: supress backlinks at G_TOPOLOGY ioctl



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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 28b6ba11
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -333,6 +333,9 @@ static long __media_device_get_topology(struct media_device *mdev,
	/* Get links and number of links */
	/* Get links and number of links */
	i = 0;
	i = 0;
	media_device_for_each_link(link, mdev) {
	media_device_for_each_link(link, mdev) {
		if (link->is_backlink)
			continue;

		i++;
		i++;


		if (ret || !topo->links)
		if (ret || !topo->links)
+1 −0
Original line number Original line Diff line number Diff line
@@ -625,6 +625,7 @@ media_create_pad_link(struct media_entity *source, u16 source_pad,
	backlink->source = &source->pads[source_pad];
	backlink->source = &source->pads[source_pad];
	backlink->sink = &sink->pads[sink_pad];
	backlink->sink = &sink->pads[sink_pad];
	backlink->flags = flags;
	backlink->flags = flags;
	backlink->is_backlink = true;


	/* Initialize graph object embedded at the new link */
	/* Initialize graph object embedded at the new link */
	media_gobj_init(sink->graph_obj.mdev, MEDIA_GRAPH_LINK,
	media_gobj_init(sink->graph_obj.mdev, MEDIA_GRAPH_LINK,
+2 −0
Original line number Original line Diff line number Diff line
@@ -96,6 +96,7 @@ struct media_pipeline {
 * @reverse:	Pointer to the link for the reverse direction of a pad to pad
 * @reverse:	Pointer to the link for the reverse direction of a pad to pad
 *		link.
 *		link.
 * @flags:	Link flags, as defined in uapi/media.h (MEDIA_LNK_FL_*)
 * @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_link {
	struct media_gobj graph_obj;
	struct media_gobj graph_obj;
@@ -112,6 +113,7 @@ struct media_link {
	};
	};
	struct media_link *reverse;
	struct media_link *reverse;
	unsigned long flags;
	unsigned long flags;
	bool is_backlink;
};
};


/**
/**