Message ID | 20240808-device_child_node_access-v2-0-fc757cc76650@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | use device_for_each_child_node_scoped to access device child nodes | expand |
On Thu, 08 Aug 2024 17:12:36 +0200, Javier Carrasco wrote: > 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. > > [...] Applied, to coresight next tree. Thanks! [1/3] coresight: cti: use device_* to iterate over device child nodes https://git.kernel.org/coresight/c/daca644d0c9e0 Best regards,
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 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 (3): coresight: cti: use device_* to iterate over device child nodes iio: adc: xilinx-ams: use device_* to iterate over device child nodes leds: as3645a: use device_* to iterate over device child nodes drivers/hwtracing/coresight/coresight-cti-platform.c | 10 +++------- drivers/iio/adc/xilinx-ams.c | 15 +++++---------- drivers/leds/flash/leds-as3645a.c | 8 +++----- 3 files changed, 11 insertions(+), 22 deletions(-) --- base-commit: 222a3380f92b8791d4eeedf7cd750513ff428adf change-id: 20240725-device_child_node_access-442533910a6f Best regards,