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 6BCBBC3DA4A for ; Sat, 3 Aug 2024 11:18:59 +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=PMkD6W4z2WIJZejpQn7S3tMT0ZX6Sg4ld17TggjTi14=; b=FXvHfCKFVscN4G5y91FNbRjpYc LZHkvdpuKO5yBtShPoFy0sk0WT1V9nfndhE0sycn1tfTJfBA8xXuPQyT2MdtHjtiXHSAC5+4h0OkZ nSnA57P7wcY3C9eQPhy5hgzzZlO/v/lAl1i7vg8WjUJhlQ+oCdwCAqg6TfLuOvrudBlx24PYzochC /OddCtMwTKWjGTv6Fbj7uFfmImKmcQ8BEKPxmA1o30gigpQG9ZG+YBswCUC2wNqQ30NWSM3WUgP6f VpmOJ0OBEYvedfZ/ZF4wOmFHecsOUPqfG/EqOlREE6WWCH+zkGN5yNy4ExGKKs4T4t4xzz7bdIY31 RJjb1HFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1saCmf-0000000BIZb-2FcP; Sat, 03 Aug 2024 11:18:49 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1saClv-0000000BIPl-46ez for linux-arm-kernel@lists.infradead.org; Sat, 03 Aug 2024 11:18:05 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 0562FCE04F0; Sat, 3 Aug 2024 11:18:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3383EC4AF0A; Sat, 3 Aug 2024 11:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722683881; bh=GXT0DgK5j3DMMtu/LmcbliLAhERbqe/7eBNWpDi1a9o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UbrbsJbxioKaVmV6FKTUJCvcgHt5aeTxT9xEFF3pByxbsAA61ufqlCKxY5K6x9rpr vKyBK+K5JHCpnL183MELDvStw4Cgn3wqhFhJxkjftxEFWj7AM2ypZfm7oJA1PKdjiU z/G50+BaKexgg35NXLhQLqHx6PBQ8jHhCEdtg76InTK0JNNMh7FsSbkzeRUanVx952 RE9Cltc0NTlIRJqTZYpiArFSuYuN6KgMDOKsDaXRLIu8MI9V1D8bS73sMezdvPKVLj mm7PxuXl/JwKM70GvPhMm5D3WZ9ZeSzPkTyvLIrcLAoUzppSV3HZefsNRmJd66KNM7 02I2mxxR9onNA== Date: Sat, 3 Aug 2024 12:17:52 +0100 From: Jonathan Cameron To: Nuno =?UTF-8?B?U8Oh?= Cc: Javier Carrasco , Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Michael Hennerich , Lars-Peter Clausen , Anand Ashok Dumbre , Michal Simek , Sakari Ailus , Pavel Machek , Lee Jones , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-leds@vger.kernel.org Subject: Re: [PATCH 2/4] iio: adc: ad7768-1: use device_* to iterate over device child nodes Message-ID: <20240803121752.4d9693bc@jic23-huawei> In-Reply-To: <02bda6f37ac5ed171429a980b9a3ac69cd4efcf9.camel@gmail.com> References: <20240801-device_child_node_access-v1-0-ddfa21bef6f2@gmail.com> <20240801-device_child_node_access-v1-2-ddfa21bef6f2@gmail.com> <02bda6f37ac5ed171429a980b9a3ac69cd4efcf9.camel@gmail.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240803_041804_216753_FFEC7791 X-CRM114-Status: GOOD ( 17.27 ) 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 On Thu, 01 Aug 2024 09:31:16 +0200 Nuno S=C3=A1 wrote: > On Thu, 2024-08-01 at 08:13 +0200, Javier Carrasco wrote: > > Drop the manual access to the fwnode of the device to iterate over its > > child nodes. `device_for_each_child_node` macro provides direct access > > to the child nodes, and given that they are only required within the > > loop, the scoped variant of the macro can be used. > >=20 > > Use the `device_for_each_child_node_scoped` macro to iterate over the > > direct child nodes of the device. > >=20 > > Signed-off-by: Javier Carrasco > > --- =20 >=20 > Reviewed-by: Nuno Sa Applied >=20 > > =C2=A0drivers/iio/adc/ad7768-1.c | 5 +---- > > =C2=A01 file changed, 1 insertion(+), 4 deletions(-) > >=20 > > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > > index 70a25949142c..721672fe84ab 100644 > > --- a/drivers/iio/adc/ad7768-1.c > > +++ b/drivers/iio/adc/ad7768-1.c > > @@ -544,13 +544,10 @@ static int ad7768_set_channel_label(struct iio_dev > > *indio_dev, > > =C2=A0{ > > =C2=A0 struct ad7768_state *st =3D iio_priv(indio_dev); > > =C2=A0 struct device *device =3D indio_dev->dev.parent; > > - struct fwnode_handle *fwnode; > > - struct fwnode_handle *child; > > =C2=A0 const char *label; > > =C2=A0 int crt_ch =3D 0; > > =C2=A0 > > - fwnode =3D dev_fwnode(device); > > - fwnode_for_each_child_node(fwnode, child) { > > + device_for_each_child_node_scoped(device, child) { > > =C2=A0 if (fwnode_property_read_u32(child, "reg", &crt_ch)) > > =C2=A0 continue; > > =C2=A0 > > =20 >=20