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 A752FC5321D for ; Mon, 26 Aug 2024 11:05:23 +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=RZx52hwdIcIW1BBZSrKrl0v4gM9idpGedjmZ2rBiM0c=; b=m3braeIu1I4GlIGaJUFClmU9p7 9fonTreImux53dqtPR7k/LNYWqvAWlAkKEizfUL+2uQfeRoyoGRp60ziqUQNA6aQvVNkBrEEJM/3c B50C5gAagq79x4ftZB8Is4QVc8PwtdLeXK4qyK5Sse+K0DZ7D9SvIdxq7gks+RMEk2R4oieGWaKmb EtrnV+j5vemtGS4hU4r55SxXnWg8FyQQDkzID189JG3ULh7HDGGEu6T6DSzWHXz9kZYj4UvUvAaa0 0V2r1ZUZAUBMPFyNBVxltLcJnyPoWJZCOWlh/TbRC2KXfEl8hfMqHQEoiwdg9Voafz1RnvvLe70oR wFsRkjZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXX6-000000074Yb-2F1A; Mon, 26 Aug 2024 11:05:12 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXUW-000000073qe-0aq3 for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 11:02:33 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 05210A4256A; Mon, 26 Aug 2024 11:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84929C51436; Mon, 26 Aug 2024 10:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724669560; bh=q02QQHNSPXQ2BpaRfA4j+Kddrd7KJZ3iKb/VL/LUe64=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RzMhNFqNTgXUW/aD9kPhiKSzQESHhFWTzKO1lsPgyvemBdgPR9ziewWG7UjeE0yvI 3xjt1snY9VHSOPdIYNC31+xjKfkuYglTzzXEMy2dPFwQfMELn/hNZU7hy/rjle3Gql I2igg5bDZxyWH5fuY2XbEeWGcAz73rnGwLkChirACmu5pk1I195fiEfIQM+xz6vCdk qbHA1wLOJL2uo2tWg9/pb/zudA5M68xgphYHHyEXYKTX3G8qhvntGgG1/y47dac8IX xw3/8mAYnLLlI4AISai9aNq09yDclODd/kbTzDMKo/ayGrlSBhXgsT96BBQn0D9jEN Q4QfBlmjRl89w== Date: Mon, 26 Aug 2024 11:52:26 +0100 From: Jonathan Cameron To: Javier Carrasco Cc: 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 v3 1/2] iio: adc: xilinx-ams: use device_* to iterate over device child nodes Message-ID: <20240826115226.43027f1b@jic23-huawei> In-Reply-To: <20240820-device_child_node_access-v3-1-1ee09bdedb9e@gmail.com> References: <20240820-device_child_node_access-v3-0-1ee09bdedb9e@gmail.com> <20240820-device_child_node_access-v3-1-1ee09bdedb9e@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=US-ASCII Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_040232_326206_210E8246 X-CRM114-Status: GOOD ( 24.01 ) 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 Tue, 20 Aug 2024 21:02:26 +0200 Javier Carrasco wrote: > Use `device_for_each_child_node_scoped()` in `ams_parse_firmware()` > to explicitly state device child node access, and simplify the child > node handling as it is not required outside the loop. > > Signed-off-by: Javier Carrasco Applied, but I would ideally still like one of the xilinx folk others familiar with this driver to take a look. It'll be a few days before this ends up in next anyway as I need to rebase after Greg (hopefully) takes the pull request from last week. It would be lovely to get rid of the direct fwnode usage in here but I'm not 100% sure if there is a path that will land on a disabled fwnode. Thanks, Jonathan > --- > drivers/iio/adc/xilinx-ams.c | 15 +++++---------- > 1 file changed, 5 insertions(+), 10 deletions(-) > > diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c > index f051358d6b50..ebc583b07e0c 100644 > --- a/drivers/iio/adc/xilinx-ams.c > +++ b/drivers/iio/adc/xilinx-ams.c > @@ -1275,7 +1275,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev) > struct ams *ams = iio_priv(indio_dev); > struct iio_chan_spec *ams_channels, *dev_channels; > struct device *dev = indio_dev->dev.parent; > - struct fwnode_handle *child = NULL; > struct fwnode_handle *fwnode = dev_fwnode(dev); > size_t ams_size; > int ret, ch_cnt = 0, i, rising_off, falling_off; > @@ -1297,16 +1296,12 @@ static int ams_parse_firmware(struct iio_dev *indio_dev) > num_channels += ret; > } > > - fwnode_for_each_child_node(fwnode, child) { > - if (fwnode_device_is_available(child)) { > - ret = ams_init_module(indio_dev, child, ams_channels + num_channels); > - if (ret < 0) { > - fwnode_handle_put(child); > - return ret; > - } > + device_for_each_child_node_scoped(dev, child) { > + ret = ams_init_module(indio_dev, child, ams_channels + num_channels); > + if (ret < 0) > + return ret; > > - num_channels += ret; > - } > + num_channels += ret; > } > > for (i = 0; i < num_channels; i++) { >