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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 739D5C433F5 for ; Wed, 12 Jan 2022 22:24:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 99C2B83248; Wed, 12 Jan 2022 23:24:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="jrKnherZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A755183373; Wed, 12 Jan 2022 23:24:42 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9542B83180 for ; Wed, 12 Jan 2022 23:24:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CEB0961AF5; Wed, 12 Jan 2022 22:24:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75064C36AE5; Wed, 12 Jan 2022 22:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642026277; bh=7gnZ5xegZhjVXYqDP0kYZQmRIScZUwAf2EY2KOgY160=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jrKnherZZCvMnApI5K+tSDABHRfTVwwwqow3YXMlILSJHuCxHCSZewZQzWZCE8wdh iCSd9itBvzDqdNC779zrvFsN3GYEMF1KYkH6MRLIc7Pl4bBSurJJaSe9WbomGkhlFp jz388GhE3UgKzgrymuvVboorVW1oZqyiVfllavwxccyRutQG+QB80kIUauPD60MdqU P5Szqg0TvtwkMsez5YPnnxqp/Fwh12oOKgo7e7Yc+JRvuf15Mil+9WnJ7dEwKNKNFJ EdbxgkMCJeyLqtb31Xf5kkeRoydm4oXE6GTL9d5kFaGRN8lCtsTVGxX6NPX6fn1zgw tHpxXRgS0G1QA== Date: Wed, 12 Jan 2022 23:24:26 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Simon Glass Cc: Albert Aribaud , Tom Warren , Aaron Williams , Daniel Schwierzeck , York Sun , Priyanka Jain , Oliver Graute , Meenakshi Aggarwal , Wasim Khan , Joe Hershberger , Ramon Fried , Anatolij Gustschin , Neil Armstrong , Jagan Teki , Andre Przywara , Biwen Li , Chaitanya Sakinam , Anji J , Michael Walle , Stefan Roese , Marek =?UTF-8?B?QmVow7pu?= , Vladimir Oltean , Bin Meng , Hou Zhiqiang , Pali =?UTF-8?B?Um9ow6Fy?= , Igal Liberman , U-Boot Mailing List , u-boot-amlogic@groups.io Subject: Re: [PATCH u-boot-dm v2] fdt_support: Add fdt_for_each_node_by_compatible() helper macro Message-ID: <20220112232426.7214a3e4@thinkpad> In-Reply-To: References: <20220110104639.13744-1-kabel@kernel.org> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Wed, 12 Jan 2022 13:04:08 -0700 Simon Glass wrote: > Hi Marek, >=20 > On Mon, 10 Jan 2022 at 03:46, Marek Beh=C3=BAn wrote: > > > > From: Marek Beh=C3=BAn > > > > Add macro fdt_for_each_node_by_compatible() to allow iterating over > > fdt nodes by compatible string. > > > > Convert various usages of > > off =3D fdt_node_offset_by_compatible(fdt, start, compat); > > while (off > 0) { > > code(); > > off =3D fdt_node_offset_by_compatible(fdt, off, compat); > > } > > and similar, to > > fdt_for_each_node_by_compatible(off, fdt, start, compat) > > code(); > > > > Signed-off-by: Marek Beh=C3=BAn > > Reviewed-by: Stefan Roese > > --- > > Simon, as in v1, this applies on top of marvell/next and we have another > > patch for marvell/next that depends on this. > > Could we let him apply it there after it is reviewed? > > Thanks. > > > > Changes since v1: > > - removed extra space after macro name: > > fdt_for_each_node_by_compatible (...) > > to > > fdt_for_each_node_by_compatible(...) > > as requested by Stefan > > --- > > arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 9 ++------- > > arch/arm/cpu/armv8/fsl-layerscape/icid.c | 5 +---- > > arch/arm/mach-tegra/gpu.c | 5 +---- > > arch/mips/mach-octeon/octeon_fdt.c | 11 ++--------- > > arch/powerpc/cpu/mpc85xx/liodn.c | 9 ++------- > > board/Marvell/octeon_ebb7304/board.c | 9 +++------ > > board/congatec/cgtqmx8/spl.c | 7 ++----- > > board/freescale/lx2160a/lx2160a.c | 5 +---- > > common/fdt_support.c | 22 ++++++++-------------- > > drivers/misc/fsl_portals.c | 6 +----- > > drivers/net/fm/fdt.c | 3 +-- > > drivers/pci/pcie_layerscape_fixup_common.c | 12 ++---------- > > drivers/phy/marvell/comphy_a3700.c | 10 +++++----- > > drivers/video/meson/simplefb_common.c | 7 ++----- > > drivers/video/sunxi/simplefb_common.c | 5 ++--- > > include/fdt_support.h | 6 ++++++ > > 16 files changed, 41 insertions(+), 90 deletions(-) =20 >=20 > Reviewed-by: Simon Glass >=20 > In general we should not be doing this sort of thing. There should be > a driver for each string, so we don't need this kind of ad-hoc code. Dear Simon, you are right for when this is used for U-Boot functionality. But when we need to fixup devicetree for Linux, this is the right thing to do. I need this macro for ft_board_setup(). Marek