From patchwork Sun Sep 6 17:30:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 7132111 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4F730BEEC1 for ; Sun, 6 Sep 2015 17:31:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6253F206CD for ; Sun, 6 Sep 2015 17:31:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FE29206C0 for ; Sun, 6 Sep 2015 17:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837AbbIFRbi (ORCPT ); Sun, 6 Sep 2015 13:31:38 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:53823 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786AbbIFRbf (ORCPT ); Sun, 6 Sep 2015 13:31:35 -0400 Received: from 201.86.133.245.dynamic.adsl.gvt.net.br ([201.86.133.245] helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZYdmx-0008Hh-2b; Sun, 06 Sep 2015 17:31:35 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.85) (envelope-from ) id 1ZYdmS-0004lA-N0; Sun, 06 Sep 2015 14:31:04 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Cc: Mauro Carvalho Chehab Subject: [PATCH 04/18] [media] media-device: supress backlinks at G_TOPOLOGY ioctl Date: Sun, 6 Sep 2015 14:30:47 -0300 Message-Id: <7cc4f0ce2266e6300d349535e705941a190398e9.1441559233.git.mchehab@osg.samsung.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Mauro Carvalho Chehab Acked-by: Hans Verkuil diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 0238885fcc74..97eb97d9b662 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -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) diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index cd4d767644df..4868b8269204 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -648,6 +648,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, diff --git a/include/media/media-entity.h b/include/media/media-entity.h index e1a89899deef..3d389f142a1d 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -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 at 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; }; /**