From patchwork Mon Aug 30 11:01:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 504817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 284ABC43214 for ; Mon, 30 Aug 2021 11:02:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1202861139 for ; Mon, 30 Aug 2021 11:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236503AbhH3LDb (ORCPT ); Mon, 30 Aug 2021 07:03:31 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:43892 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236477AbhH3LD1 (ORCPT ); Mon, 30 Aug 2021 07:03:27 -0400 Received: from deskari.lan (91-158-153-130.elisa-laajakaista.fi [91.158.153.130]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D187F1924; Mon, 30 Aug 2021 13:02:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630321348; bh=YHZvmeGd5HTtm5USFRz0/NGI/WH25omht+wndPg3R+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R8+LZh3iKn7Xg8bN8qQMLFpRaHCPgdhks06nKERghpsI6bwjMPrgbXOyVvP0eDOdy xiBb0iJPGQvpg3qxnumWxzY9pKHLaZU5jmWFqJmUqDI5mVgfCKlECiyObyrBqX/5FJ 4KJpmLFgeeJUV9PULGJb9NiwW347zyIfdTcjYjyA= From: Tomi Valkeinen To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com, Jacopo Mondi , Laurent Pinchart , niklas.soderlund+renesas@ragnatech.se Cc: Mauro Carvalho Chehab , Hans Verkuil , Tomi Valkeinen , Pratyush Yadav , Lokesh Vutla Subject: [PATCH v8 20/36] media: entity: Add only connected pads to the pipeline Date: Mon, 30 Aug 2021 14:01:00 +0300 Message-Id: <20210830110116.488338-21-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210830110116.488338-1-tomi.valkeinen@ideasonboard.com> References: <20210830110116.488338-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Sakari Ailus A single entity may contain multiple pipelines. Only add pads that were connected to the pad through which the entity was reached to the pipeline. Signed-off-by: Sakari Ailus Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi Signed-off-by: Tomi Valkeinen --- drivers/media/mc/mc-entity.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 072f017b399a..4eb4b94c09e2 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -474,7 +474,7 @@ __must_check int __media_pipeline_start(struct media_pad *pad, ret = 0; - media_entity_for_each_pad(entity, iter) { + media_entity_for_each_routed_pad(pad, iter) { if (iter->pipe && iter->pipe != pipe) { pr_err("Pipe active for %s. Can't start for %s\n", entity->name, iter->entity->name); @@ -563,10 +563,9 @@ __must_check int __media_pipeline_start(struct media_pad *pad, media_graph_walk_start(graph, pad_err); while ((pad_err = media_graph_walk_next(graph))) { - struct media_entity *entity = pad_err->entity; struct media_pad *iter; - media_entity_for_each_pad(entity, iter) { + media_entity_for_each_routed_pad(pad_err, iter) { /* Sanity check for negative stream_count */ if (!WARN_ON_ONCE(iter->stream_count <= 0)) { --iter->stream_count; @@ -619,10 +618,9 @@ void __media_pipeline_stop(struct media_pad *pad) media_graph_walk_start(graph, pad); while ((pad = media_graph_walk_next(graph))) { - struct media_entity *entity = pad->entity; struct media_pad *iter; - media_entity_for_each_pad(entity, iter) { + media_entity_for_each_routed_pad(pad, iter) { /* Sanity check for negative stream_count */ if (!WARN_ON_ONCE(iter->stream_count <= 0)) { iter->stream_count--;