From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Suzuki K Poulose <suzuki.poulose@arm.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,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: [PATCH v3 0/2] use device_for_each_child_node_scoped to access device child nodes
Date: Tue, 20 Aug 2024 21:02:25 +0200 [thread overview]
Message-ID: <20240820-device_child_node_access-v3-0-1ee09bdedb9e@gmail.com> (raw)
This series removes accesses to the device `fwnode` to iterate over its
own child nodes. Using the `device_for_each_child_node` macro provides
direct access to the device child nodes, and given that in all cases
they are only required within the loop, the scoped variant of the macro
can be used.
It has been stated in previous discussions [1] that `device_for_each_*`
should be used to access device child nodes, removing the need to access
its internal fwnode, and restricting `fwnode_for_each_*` to traversing
subnodes when required.
Note that `device_for_each_*` implies availability, which means that
after this conversion, unavailable nodes will not be accessible within
the loop. The affected drivers does not seem to have any reason to
iterate over unavailable nodes, though. But if someone has a case where
the affected drivers might require accessing unavailable nodes, please
let me know.
Link: https://lore.kernel.org/linux-hwmon/cffb5885-3cbc-480c-ab6d-4a442d1afb8a@gmail.com/ [1]
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Changes in v3:
- leds-as3645a: swap the parameters in as3645a_parse_node() to have dev
at the beginning.
- Rebase onto next-20240820, drop upstreamed patches (changes for
coresight-cti-platform).
- Link to v2: https://lore.kernel.org/r/20240808-device_child_node_access-v2-0-fc757cc76650@gmail.com
Changes in v2:
- Rebase onto next-20240808, drop upstreamed patches (changes for ad7768-1)
- xilinx-ams.c: drop fwnode_device_is_available(child) (implicit in the
loop).
- Link to v1: https://lore.kernel.org/r/20240801-device_child_node_access-v1-0-ddfa21bef6f2@gmail.com
---
Javier Carrasco (2):
iio: adc: xilinx-ams: use device_* to iterate over device child nodes
leds: as3645a: use device_* to iterate over device child nodes
drivers/iio/adc/xilinx-ams.c | 15 +++++----------
drivers/leds/flash/leds-as3645a.c | 8 +++-----
2 files changed, 8 insertions(+), 15 deletions(-)
---
base-commit: bb1b0acdcd66e0d8eedee3570d249e076b89ab32
change-id: 20240725-device_child_node_access-442533910a6f
Best regards,
--
Javier Carrasco <javier.carrasco.cruz@gmail.com>
next reply other threads:[~2024-08-20 19:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 19:02 Javier Carrasco [this message]
2024-08-20 19:02 ` [PATCH v3 1/2] iio: adc: xilinx-ams: use device_* to iterate over device child nodes Javier Carrasco
2024-08-26 10:52 ` Jonathan Cameron
2024-08-26 11:15 ` Michal Simek
2024-08-20 19:02 ` [PATCH v3 2/2] leds: as3645a: " Javier Carrasco
2024-08-22 13:36 ` (subset) " Lee Jones
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=20240820-device_child_node_access-v3-0-1ee09bdedb9e@gmail.com \
--to=javier.carrasco.cruz@gmail.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=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 \
--cc=suzuki.poulose@arm.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