From patchwork Wed Jul 27 10:36:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 593930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44D77C19F29 for ; Wed, 27 Jul 2022 10:37:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230463AbiG0Khq (ORCPT ); Wed, 27 Jul 2022 06:37:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbiG0Khh (ORCPT ); Wed, 27 Jul 2022 06:37:37 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7E9F474D1 for ; Wed, 27 Jul 2022 03:37:35 -0700 (PDT) Received: from deskari.lan (91-158-154-79.elisa-laajakaista.fi [91.158.154.79]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C5943842; Wed, 27 Jul 2022 12:37:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1658918235; bh=wAWO2u9icHUtQqJEtST5UmncCV/f3+RrQD+6P5oIq/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qpTL23DnM8oWSc1CD24SsP3kBE1UFBW3gWC8cKrSRhiUFLD+WDcopPThrJLuXoARP fE3gIWck7Rie9KyClmimVBxeddSRAB1z7FHNmKLy6WYmDiqN7H7CMkKlrX5vt3UJ7s rLu4CAezu12IjBBq3v5y04cwJZFHsQP2+G2O7ygY= From: Tomi Valkeinen To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com, Jacopo Mondi , Laurent Pinchart , niklas.soderlund+renesas@ragnatech.se, Mauro Carvalho Chehab , Hans Verkuil , Pratyush Yadav , Kishon Vijay Abraham , satish.nagireddy@getcruise.com, Tomasz Figa Cc: Tomi Valkeinen Subject: [PATCH v12 24/30] media: subdev: use for_each_active_route() in v4l2_subdev_init_stream_configs() Date: Wed, 27 Jul 2022 13:36:33 +0300 Message-Id: <20220727103639.581567-25-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220727103639.581567-1-tomi.valkeinen@ideasonboard.com> References: <20220727103639.581567-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use for_each_active_route() in v4l2_subdev_init_stream_configs(). Signed-off-by: Tomi Valkeinen --- drivers/media/v4l2-core/v4l2-subdev.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index f3219c8a6317..97c77b32ca1d 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -929,8 +929,8 @@ static int v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_configs, const struct v4l2_subdev_krouting *routing) { + struct v4l2_subdev_route *route; u32 num_configs = 0; - unsigned int i; u32 format_idx = 0; kvfree(stream_configs->configs); @@ -938,12 +938,7 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config stream_configs->num_configs = 0; /* Count number of formats needed */ - for (i = 0; i < routing->num_routes; ++i) { - struct v4l2_subdev_route *route = &routing->routes[i]; - - if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE)) - continue; - + for_each_active_route(routing, route) { /* * Each route needs a format on both ends of the route, except * for source streams which only need one format. @@ -968,13 +963,9 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config * Fill in the 'pad' and stream' value for each item in the array from * the routing table */ - for (i = 0; i < routing->num_routes; ++i) { - struct v4l2_subdev_route *route = &routing->routes[i]; + for_each_active_route(routing, route) { u32 idx; - if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE)) - continue; - if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_SOURCE)) { idx = format_idx++;