From patchwork Mon Dec 13 23:28:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15158 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6A3F7C324B for ; Mon, 13 Dec 2021 23:29:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E5E046088C; Tue, 14 Dec 2021 00:29:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fxhgQRcO"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B9A5E60822 for ; Tue, 14 Dec 2021 00:29:07 +0100 (CET) Received: by mail-wr1-x42b.google.com with SMTP id d24so29772502wra.0 for ; Mon, 13 Dec 2021 15:29:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YXsT7zHvatos7XfOBq5N+1fMVdHFdvEUedxZf+J7ouc=; b=fxhgQRcO3QjWRe/SJ1N8l/dwU94LkdYqBNc73Z3DonjM/hF0CBPS6bIUTinqONJnXI Fj5JsTofGIe+mNUj6MQXrhokJ2L1DAfmIgbzO/WhCbm/uwn3CHeW3TXGJl7UtqoNK/iF 7kVRRs3FARTEZys1ICGAWvwTag8auTAosg3Qf0J/BTFoSBBEuobmLZX41x4uzJD6gUh2 FIxSe/OLhu40D6B440Xgza0J7zTMhEeYrIuWepq3S4c4valO3XRg6q1roCx58dQC7ksn Btd+CWgDx96LGsAJ467f2/fUXnsdy0Tl5mFTmovBRiwD6z3P/OwoEAU6GP0BB8aEtrWf zuOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YXsT7zHvatos7XfOBq5N+1fMVdHFdvEUedxZf+J7ouc=; b=GpiHWBRP5OPa1M068KkX/ltd5mwxRk6nBXCOxbIaFGoISV83WKRmDzNwrTs6T9GI2Y pWqtiAYiF1t9bx+cjsDDPqxVNIDFWqLxCkkqk9rkdabiYjZSlRjH/DPKUYTiaMZ4Ndm9 Pwx2paziglgNfVbd8Pb/Op/vKPzf1Jft9492OgSomuY7uU2uuQctaxhQ6y8sDY0smwme EjU84H1Q2OYTcOO0OkKZ12Uj2sYDaNKLEw+H+1AAiA9dHIBZuT66hhorQUUJ6ZuDJdEn Nd2E4i8xhsGP28cLbyJW3bnF+PBfwwl2DeBZeMEIoUNxXEzsEts4E/rsLoc9XTX/Qwvc XSjw== X-Gm-Message-State: AOAM533c5/CQQ3U0Q5+9AyO+MPRIupxbkot1uL/dN42/E1/c69KetqwQ dlZBsR1gfFsz0YjtHg1o5Rs= X-Google-Smtp-Source: ABdhPJxeFbxUyR8zW1g6fsTTqYu59SfX5eNdc/kncZmO/Gws0iR95QnRUxeRMq/ihdiJnI3MIsHU4Q== X-Received: by 2002:adf:f504:: with SMTP id q4mr1724215wro.698.1639438147393; Mon, 13 Dec 2021 15:29:07 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id 38sm12551643wrc.1.2021.12.13.15.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 15:29:07 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org Date: Mon, 13 Dec 2021 23:28:47 +0000 Message-Id: <20211213232849.40071-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211213232849.40071-1-djrscally@gmail.com> References: <20211213232849.40071-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/5] media: entity: Skip non-data links in graph iteration X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sakari.ailus@linux.intel.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When iterating over the media graph, don't follow links that are not pad-to-pad links. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- Changes since the rfc: - new patch drivers/media/mc/mc-entity.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index d79eb88bc167..aeddc3f6310e 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -325,6 +325,14 @@ static void media_graph_walk_iter(struct media_graph *graph) link = list_entry(link_top(graph), typeof(*link), list); + /* If the link is not a pad-to-pad link, don't follow it */ + if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) { + link_top(graph) = link_top(graph)->next; + dev_dbg(entity->graph_obj.mdev->dev, "walk: skipping %s link\n", + link_type(link)); + return; + } + /* The link is not enabled so we do not follow. */ if (!(link->flags & MEDIA_LNK_FL_ENABLED)) { link_top(graph) = link_top(graph)->next;