From patchwork Tue Apr 27 12:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 428114 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 688E0C43470 for ; Tue, 27 Apr 2021 12:46:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 404A5613EF for ; Tue, 27 Apr 2021 12:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237756AbhD0MrB (ORCPT ); Tue, 27 Apr 2021 08:47:01 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:45230 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237743AbhD0Mq7 (ORCPT ); Tue, 27 Apr 2021 08:46:59 -0400 Received: from deskari.lan (91-157-208-71.elisa-laajakaista.fi [91.157.208.71]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E84CE1242; Tue, 27 Apr 2021 14:46:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1619527575; bh=kToWsVi8/jk6eCdP3PqD2ZzFB2YJwXAYSFgcfvzOSTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9OJwKa7VC5xL2B3uglwv8AE825Yrv1vtIdy4yOTqYh1uj2NxWUuRwXrqzIEDzSD7 eqvnw0lTr361ai4DAvr58MZzak3MGOdNnsNkd9xXdrXC0CljHLuoM0e6gVkJQk+Khp GwVs/Ue4vn2hn3hTleeFIzdrQTPUM17MQKxCrKBM= 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 Subject: [PATCH v6 13/24] media: entity: Add only connected pads to the pipeline Date: Tue, 27 Apr 2021 15:45:12 +0300 Message-Id: <20210427124523.990938-14-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210427124523.990938-1-tomi.valkeinen@ideasonboard.com> References: <20210427124523.990938-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 a4cca53124b2..2b70ef97c56c 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -457,7 +457,7 @@ __must_check int __media_pipeline_start(struct media_pad *pad, DECLARE_BITMAP(active, MEDIA_ENTITY_MAX_PADS); DECLARE_BITMAP(has_no_links, MEDIA_ENTITY_MAX_PADS); - 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); @@ -546,10 +546,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; @@ -602,10 +601,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--;