From patchwork Fri Dec 11 20:17:53 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: 7832671 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AC1DF9F387 for ; Fri, 11 Dec 2015 20:18:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC6C1204E0 for ; Fri, 11 Dec 2015 20:18:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D82D5204AF for ; Fri, 11 Dec 2015 20:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752414AbbLKUSI (ORCPT ); Fri, 11 Dec 2015 15:18:08 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:39979 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751437AbbLKUSH (ORCPT ); Fri, 11 Dec 2015 15:18:07 -0500 Received: from 179.186.108.20.dynamic.adsl.gvt.net.br ([179.186.108.20] helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1a7U8k-0003eV-Lj; Fri, 11 Dec 2015 20:18:06 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.86) (envelope-from ) id 1a7U8Z-0002kZ-2B; Fri, 11 Dec 2015 18:17:55 -0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab Subject: [PATCH 2/2] [media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation Date: Fri, 11 Dec 2015 18:17:53 -0200 Message-Id: <8b0b503ba0b1246fab5519df7fe675c78989e4e9.1449865071.git.mchehab@osg.samsung.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1cb01ccf2694e93040738f4dd12a86bcf8ce4994.1449865071.git.mchehab@osg.samsung.com> References: <1cb01ccf2694e93040738f4dd12a86bcf8ce4994.1449865071.git.mchehab@osg.samsung.com> In-Reply-To: <1cb01ccf2694e93040738f4dd12a86bcf8ce4994.1449865071.git.mchehab@osg.samsung.com> References: <1cb01ccf2694e93040738f4dd12a86bcf8ce4994.1449865071.git.mchehab@osg.samsung.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Instead of flagging an interface link as MEDIA_LNK_FL_INTERFACE_LINK only when returning to userspace, do it at link creation time. That would allow using such flag internally, and cleans up a little bit the code for G_TOPOLOGY ioctl. Suggested-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/media-device.c | 3 --- drivers/media/media-entity.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 6406914a9bf5..c12481c753a0 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -361,9 +361,6 @@ static long __media_device_get_topology(struct media_device *mdev, klink.sink_id = link->gobj1->id; klink.flags = link->flags; - if (media_type(link->gobj0) != MEDIA_GRAPH_PAD) - klink.flags |= MEDIA_LNK_FL_INTERFACE_LINK; - if (copy_to_user(ulink, &klink, sizeof(klink))) ret = -EFAULT; ulink++; diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 181ca0de6e52..7895e17aeee9 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -526,7 +526,7 @@ media_create_pad_link(struct media_entity *source, u16 source_pad, link->source = &source->pads[source_pad]; link->sink = &sink->pads[sink_pad]; - link->flags = flags; + link->flags = flags && ~MEDIA_LNK_FL_INTERFACE_LINK; /* Initialize graph object embedded at the new link */ media_gobj_create(source->graph_obj.mdev, MEDIA_GRAPH_LINK, @@ -756,7 +756,7 @@ struct media_link *media_create_intf_link(struct media_entity *entity, link->intf = intf; link->entity = entity; - link->flags = flags; + link->flags = flags | MEDIA_LNK_FL_INTERFACE_LINK; /* Initialize graph object embedded at the new link */ media_gobj_create(intf->graph_obj.mdev, MEDIA_GRAPH_LINK,