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 39920C5321D for ; Mon, 26 Aug 2024 08:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To: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=Gw2pERuoyzjKSrNRb9ZbpaKk891LMp5POS6wV70qvdM=; b=ow5cxbr0bpZNfW5pueMlJycj2D 0kD2h+rXCaqwt5yHuEP7owJKtg0MDfUC1pWyrSaeVufPps1cJAKc2F7fVu+bIWYhpVenr8KtKEZ59 V8AE0eDz3+F6hMjJUdlBF7EGfNles9mQg46em7nczdVCryfNQGT6mfasi/M7AFLgBW7fbjg51jdKY Uz5kcN/ySLW0J5zpOm0lhynAmInF3vSeOi5TeHTDMFIcl6pFMLFpj5d+0GQMD+xKI51hkArXOEG5X WvNesm+HqMChbfaH0Bu7WS4TipCbNahn3ILQpqZ8T3O7kFFOKdy46dAOaJEith/mZqsAa1Exn2Fw0 Fpe4Ft9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siUor-00000006QES-0x96; Mon, 26 Aug 2024 08:11:21 +0000 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siUo4-00000006PwB-1mOt for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 08:10:33 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 43F691BF206; Mon, 26 Aug 2024 08:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1724659830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gw2pERuoyzjKSrNRb9ZbpaKk891LMp5POS6wV70qvdM=; b=imz1V3K4SwOZXznVz2Cyy2MWXjbnDJm8kzyvy7ZqUkIqqL388yTEggbXxohTQZLkqTCHvW 2nfWplpMqZtqU4AsqOpC/lGv6xbxc//CSgL2q6a9cLETQHGZ1vNq2Kg0l+mZdcdR4UMCoK BGEIo3VsERrHQro3X9E1YmUNsGsleG9XVgpfGfYuGYITjD7eQ1vBO9S+f8IIo5PmLuD1/O n/VABECXQUp+fzc+S9Y7bd/q7v94ax5k96zQu8rVRsjJ3fsdQwUsM9vdG3AK2bmvumSQR2 u3RCo6t18olZgFX2BmAtwuf/Hn/e8rc9Ysx8suSuRRy2f/FZK6dGLgCVQCLqKQ== Date: Mon, 26 Aug 2024 10:10:29 +0200 From: Miquel Raynal To: Krzysztof Kozlowski Cc: Vladimir Zapolskiy , Krzysztof Kozlowski , Michal Simek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jonathan Cameron Subject: Re: [PATCH 2/2] memory: pl353-smc: simplify with scoped for each OF child loop Message-ID: <20240826101029.5bde327c@xps-13> In-Reply-To: <20240825135001.48963-2-krzysztof.kozlowski@linaro.org> References: <20240825135001.48963-1-krzysztof.kozlowski@linaro.org> <20240825135001.48963-2-krzysztof.kozlowski@linaro.org> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_011032_641299_46D0C345 X-CRM114-Status: GOOD ( 16.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Krzysztof, krzysztof.kozlowski@linaro.org wrote on Sun, 25 Aug 2024 15:50:01 +0200: > Use scoped for_each_available_child_of_node_scoped() when iterating over > device nodes to make code a bit simpler. >=20 > Suggested-by: Jonathan Cameron > Signed-off-by: Krzysztof Kozlowski > --- > drivers/memory/pl353-smc.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c > index 994c7a792e34..28a8cc56003c 100644 > --- a/drivers/memory/pl353-smc.c > +++ b/drivers/memory/pl353-smc.c > @@ -74,7 +74,6 @@ static int pl353_smc_probe(struct amba_device *adev, co= nst struct amba_id *id) > struct device_node *of_node =3D adev->dev.of_node; > const struct of_device_id *match =3D NULL; > struct pl353_smc_data *pl353_smc; > - struct device_node *child; > =20 > pl353_smc =3D devm_kzalloc(&adev->dev, sizeof(*pl353_smc), GFP_KERNEL); > if (!pl353_smc) > @@ -93,12 +92,13 @@ static int pl353_smc_probe(struct amba_device *adev, = const struct amba_id *id) > amba_set_drvdata(adev, pl353_smc); > =20 > /* Find compatible children. Only a single child is supported */ > - for_each_available_child_of_node(of_node, child) { > + for_each_available_child_of_node_scoped(of_node, child) { > match =3D of_match_node(pl353_smc_supported_children, child); > if (!match) { > dev_warn(&adev->dev, "unsupported child node\n"); > continue; > } > + of_platform_device_create(child, NULL, &adev->dev); > break; > } > if (!match) { > @@ -106,9 +106,6 @@ static int pl353_smc_probe(struct amba_device *adev, = const struct amba_id *id) > return -ENODEV; > } > =20 > - of_platform_device_create(child, NULL, &adev->dev); > - of_node_put(child); > - > return 0; > } Nice. I didn't even know about the _scope() variant. Thanks Jonathan for the heads up! Reviewed-by: Miquel Raynal Cheers, Miqu=C3=A8l