From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>,
Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>,
Michal Simek <michal.simek@amd.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>
Cc: 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 1/4] coresight: cti: use device_* to iterate over device child nodes
Date: Fri, 2 Aug 2024 08:50:17 +0100 [thread overview]
Message-ID: <d5a42f3a-5bf6-4f1a-b8f1-0254770856a5@arm.com> (raw)
In-Reply-To: <e7a4fdeb-e83b-4e0d-adb8-7ea58d6b1b7d@gmail.com>
On 01/08/2024 11:37, Javier Carrasco wrote:
> On 01/08/2024 11:20, Suzuki K Poulose wrote:
>> On 01/08/2024 07:13, 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.
>>>
>>> Use the `device_for_each_child_node_scoped` macro to iterate over the
>>> direct child nodes of the device.
>>>
>>> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
>>> ---
>>> drivers/hwtracing/coresight/coresight-cti-platform.c | 10 +++-------
>>> 1 file changed, 3 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/
>>> drivers/hwtracing/coresight/coresight-cti-platform.c
>>> index ccef04f27f12..d0ae10bf6128 100644
>>> --- a/drivers/hwtracing/coresight/coresight-cti-platform.c
>>> +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c
>>> @@ -416,20 +416,16 @@ static int
>>> cti_plat_create_impdef_connections(struct device *dev,
>>> struct cti_drvdata *drvdata)
>>> {
>>> int rc = 0;
>>> - struct fwnode_handle *fwnode = dev_fwnode(dev);
>>> - struct fwnode_handle *child = NULL;
>>> - if (IS_ERR_OR_NULL(fwnode))
>>> + if (IS_ERR_OR_NULL(dev_fwnode(dev)))
>>> return -EINVAL;
>>> - fwnode_for_each_child_node(fwnode, child) {
>>> + device_for_each_child_node_scoped(dev, child) {
>>> if (cti_plat_node_name_eq(child, CTI_DT_CONNS))
>>> - rc = cti_plat_create_connection(dev, drvdata,
>>> - child);
>>> + rc = cti_plat_create_connection(dev, drvdata, child);
>>> if (rc != 0)
>>> break;
>>
>> Don't we need to fwnode_handle_put(child) here, since we removed the
>> outer one ?
>>
>> Suzuki
>>
>
> Hi Suzuki,
>
> No, we don't need fwnode_handle_put(child) anymore because the scoped
> variant of the macro is used.
Ah, apologies, was looking at the non-scoped version. I will queue this.
Suzuki
>
> Best regards,
> Javier Carrasco
next prev parent reply other threads:[~2024-08-02 7:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 6:13 [PATCH 0/4] use device_for_each_child_node_scoped to access device child nodes Javier Carrasco
2024-08-01 6:13 ` [PATCH 1/4] coresight: cti: use device_* to iterate over " Javier Carrasco
2024-08-01 9:20 ` Suzuki K Poulose
2024-08-01 10:37 ` Javier Carrasco
2024-08-02 7:50 ` Suzuki K Poulose [this message]
2024-08-01 6:13 ` [PATCH 2/4] iio: adc: ad7768-1: " Javier Carrasco
2024-08-01 7:31 ` Nuno Sá
2024-08-03 11:17 ` Jonathan Cameron
2024-08-01 6:13 ` [PATCH 3/4] iio: adc: xilinx-ams: " Javier Carrasco
2024-08-03 11:17 ` Jonathan Cameron
2024-08-01 6:13 ` [PATCH 4/4] leds: as3645a: " Javier Carrasco
2024-08-05 20:58 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5a42f3a-5bf6-4f1a-b8f1-0254770856a5@arm.com \
--to=suzuki.poulose@arm.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anand.ashok.dumbre@xilinx.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=mike.leach@linaro.org \
--cc=pavel@ucw.cz \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox