From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 420DFCDB479 for ; Wed, 24 Jun 2026 22:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/E/jHjmSmtuAeKwe+a/vkaS6zQnXZ6aGyM52n+HOofw=; b=gyk52F+H+Vep/L aRl3cqm2j/QOCWO9GyZZ22OcPe+v/rSP4w7DsXxpRwYVT64CtJe5RUPWe5UFK7GKGt77yMRHPZY1i zWZeGwfluAXQRT4fKVcDbkZRKSXYyxA8gWmYffTGynBKutddfyEhbv+uiqiZ+5gA44ZyKXHYwVNXH +N4w4MkHDzNt+MzPzCDlDYt4biORelJDW8jQbmA9eHfJTussGvQtR5nnpgleUFWkN5GTIE4vX0pk3 ODgSneoK/IrM+JfDMUd8dZcLp26Rs854DUhvxkCWojLpOSzv+7DasYPoOG7F7VxEbMsD3NIvde8ld t47TW+LJnT2GrITTRDag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wcVxh-00000008OXi-1Ay6; Wed, 24 Jun 2026 22:20:49 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wcVxe-00000008OXB-3nLw; Wed, 24 Jun 2026 22:20:48 +0000 Received: from killaraus.ideasonboard.com (2001-14ba-70f3-e800--a06.rev.dnainternet.fi [IPv6:2001:14ba:70f3:e800::a06]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 37C98929; Thu, 25 Jun 2026 00:20:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1782339604; bh=Az4Lcorrg+CspHNvux8x53XK9+wEtcYFhVqLEqIlU30=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T8b381ilsHNYyXouPKGPHHzHsCDZu2Po+cihewknDkwsEQDiFs36AfYuduBir21be rWdwZWM+NsJYQceT16fR3HSVuwBHQZ0qV+gpOKW0mKaQz+svrV5X/SfGyB84VweAjm GWeO90XdtDiCFhCFibcaMU2yPhBP3KoaIer5aOyM= Date: Thu, 25 Jun 2026 01:20:42 +0300 From: Laurent Pinchart To: Frank Li Cc: Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Mauro Carvalho Chehab , Dafna Hirschfeld , Heiko Stuebner , Bryan O'Donoghue , Vladimir Zapolskiy , Loic Poulain , driver-core@lists.linux.dev, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, imx@lists.linux.dev, Guoniu Zhou , Frank Li , Guoniu Zhou Subject: Re: [PATCH v2 0/4] media: add and use fwnode_graph_for_each_endpoint_scoped() Message-ID: <20260624222042.GN851255@killaraus.ideasonboard.com> References: <20260624-fw_scoped-v2-0-0a8db472af4a@nxp.com> <20260624191935.GG851255@killaraus.ideasonboard.com> <20260624200237.GJ851255@killaraus.ideasonboard.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260624_152047_092349_2772B232 X-CRM114-Status: GOOD ( 27.57 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Wed, Jun 24, 2026 at 03:46:48PM -0500, Frank Li wrote: > On Wed, Jun 24, 2026 at 11:02:37PM +0300, Laurent Pinchart wrote: > > On Wed, Jun 24, 2026 at 02:35:14PM -0500, Frank Li wrote: > > > On Wed, Jun 24, 2026 at 10:19:35PM +0300, Laurent Pinchart wrote: > > > > On Wed, Jun 24, 2026 at 01:00:08PM -0400, Frank.Li@oss.nxp.com wrote: > > > > > Add new helper macro fwnode_graph_for_each_endpoint_scoped() and use it > > > > > simplify media code. > > > > > > > > > > Typical example should qualcomm's driver (camss.c), the v4l2_mc.c and > > > > > rkisp1-dev.c only silience improvement. > > > > > > > > > > Anyways, *_for_each_*_scoped() already use widely and make code clean. > > > > > > > > > > Build test only. > > > > > > > > > > Sakari Ailus: > > > > > when I try to improve the patch > > > > > "Add common helper library for 1-to-1 subdev registration", I found need > > > > > camss.c pattern, so I create this small improvement firstly. > > > > > > > > Those are nice cleanups, thank you. > > > > > > > > After applying this series, the only left users of the > > > > fwnode_graph_for_each_endpoint() macro are in drivers/base/property.c. > > > > > > I already checked previously, two place use it. > > > > > > fwnode_graph_get_endpoint_count(), it will go though all endpoints, last > > > ep is NULL, which totally equial to scoped() version. > > > > > > another one fwnode_graph_get_endpoint_by_id(), which return ep, expect > > > caller to call put(). > > > > > > if use scoped() version, need use no_free_ptr() at return, which make think > > > a little bit complex. > > > > It would introduce a tiny bit of extra complexity there, but the > > advantage (in my opinion) is that we'll be able to remove the less safe > > fwnode_graph_for_each_endpoint() macro. > > > > Now one may argue that the risk of > > fwnode_graph_for_each_endpoint_scoped() is returning the iterator > > without using no_free_ptr(). I wonder if that would be easier to catch > > in static analysis tools than the current pattern that leaks a reference > > when exiting the loop early. > > It's not big deal, if everyone prefer drop fwnode_graph_for_each_endpoint(), > I can do it. Let's see what others think. If people prefer keeping both versions, I'll be OK with that. > > > It'd better leave these as it. -- Regards, Laurent Pinchart _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip