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 4B481C3DA4A for ; Fri, 16 Aug 2024 16:09:21 +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:In-Reply-To: Content-Transfer-Encoding:Content-Type: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=flo/0mo4NWJY6btCtJSKfbzyNMdEIUHPQqM1aNHeLgU=; b=GDfbYT6eVJVrpG34CT++Od6CPu nQ2/llU/dnaCzG2CXeR1GKPUJCLz9JBY5FblOubWhgeEd9QCbVc4Z0A+04f5V2zXuJ5HXy2Yzqw4L 6nGgrfgq4JOda1G3J+FhqMjp6ztGOS20JLUoEx2/IqtEy2uTI6azX9HXtu2kicS8dRh1n573+bkSo UNLszb8fI6pUZJXnUPdTybqMQJZQc3R5+FiO+jcycEmtfOmnwcDIPJa9sv3+0Mq99Lo7/6jJe+8YI uDhz9CJH4EV2DW893l2ydh7W6h+ffSF9qY/1xg/7aldfFDUJVpurrpf/NOoE2qsMrWhJ88dt40RGU fSjmxd8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sezVm-0000000DWkW-1aPY; Fri, 16 Aug 2024 16:09:10 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sezV7-0000000DWaU-3vS7 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 16:08:31 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 011D16222C; Fri, 16 Aug 2024 16:08:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8972C32782; Fri, 16 Aug 2024 16:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723824508; bh=zo8q/X1fSRtsBnuH8fxiwu/3UwY5gwODpqavldS2UHU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VO9vpP9xmM/M4DdRO1plyue8kafzxyFSCc9GpectRLdvDmmyQAYmSwbjUAhOC5k2u mda0Ufu18I5DD1TqpWZZgMnTthB3uJZnmmpqRMM353hDyt0fxS/9WkmUtNTsItuYxg mA58CQtkXF+9MmmW96kdUSxpXnuvRdxWdCe3XKgohcurM60wffbalFSybwWp75XJ1a 8Q8I4INVGfovM90LqwJbh+9HG+ba+90Z8QBHA9vfOB6H06ciZ1rBRHsiEoOCje5L5H cq4W7bEuWgbeKKSlhbI3uYtFqCiRtOxZGoecJLP7WnJHc4TXIWdRZ3y+KqkGqHrBMW u8Re3VX4L+fsg== Date: Fri, 16 Aug 2024 17:08:15 +0100 From: Lee Jones To: Javier Carrasco Cc: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , Anand Ashok Dumbre , Michal Simek , Sakari Ailus , Pavel Machek , 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 v2 3/3] leds: as3645a: use device_* to iterate over device child nodes Message-ID: <20240816160815.GD5853@google.com> References: <20240808-device_child_node_access-v2-0-fc757cc76650@gmail.com> <20240808-device_child_node_access-v2-3-fc757cc76650@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240808-device_child_node_access-v2-3-fc757cc76650@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_090830_038008_EECF0F8F X-CRM114-Status: GOOD ( 19.51 ) 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, 08 Aug 2024, 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 the `child` variable is only required > within the loop, the scoped variant of the macro can be used. > > Use the `device_for_each_child_node_scoped` macro to iterate over the > direct child nodes of the device. > > Acked-by: Sakari Ailus > Signed-off-by: Javier Carrasco > --- > drivers/leds/flash/leds-as3645a.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/leds/flash/leds-as3645a.c b/drivers/leds/flash/leds-as3645a.c > index 2c6ef321b7c8..8e6abedf6e00 100644 > --- a/drivers/leds/flash/leds-as3645a.c > +++ b/drivers/leds/flash/leds-as3645a.c > @@ -478,14 +478,12 @@ static int as3645a_detect(struct as3645a *flash) > return as3645a_write(flash, AS_BOOST_REG, AS_BOOST_CURRENT_DISABLE); > } > > -static int as3645a_parse_node(struct as3645a *flash, > - struct fwnode_handle *fwnode) > +static int as3645a_parse_node(struct as3645a *flash, struct device *dev) Please swap the parameters to have the more senior one (dev) at the start. > { > struct as3645a_config *cfg = &flash->cfg; > - struct fwnode_handle *child; > int rval; > > - fwnode_for_each_child_node(fwnode, child) { > + device_for_each_child_node_scoped(dev, child) { > u32 id = 0; > > fwnode_property_read_u32(child, "reg", &id); > @@ -686,7 +684,7 @@ static int as3645a_probe(struct i2c_client *client) > > flash->client = client; > > - rval = as3645a_parse_node(flash, dev_fwnode(&client->dev)); > + rval = as3645a_parse_node(flash, &client->dev); > if (rval < 0) > return rval; > > > -- > 2.43.0 > > -- Lee Jones [李琼斯]