From: Rosen Penev Date: Mon, 6 Jul 2026 06:57:33 +0000 (-0700) Subject: treewide: remove fwnode_for_each_available_child_node X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F24120%2Fhead;p=thirdparty%2Fopenwrt.git treewide: remove fwnode_for_each_available_child_node It's used in probe to be a generic way to iterate over the children. Confusingly, device_for_each_child_node_scoped internally calls the available loop despite not mentioning it. Avoid pointless variables. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/24120 Signed-off-by: Jonas Jelonek --- diff --git a/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c b/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c index 65a27806f27..2aeacdbda8f 100644 --- a/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c +++ b/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c @@ -326,15 +326,13 @@ static inline int msp430_check_workmode(struct spi_device *spi) static int msp430_leds_probe(struct spi_device *spi) { struct device *dev = &spi->dev; - struct fwnode_handle *fw = dev_fwnode(dev); - struct fwnode_handle *child; int rc; rc = msp430_check_workmode(spi); if (rc) return rc; - fwnode_for_each_available_child_node(fw, child) { + device_for_each_child_node_scoped(dev, child) { u32 reg; if (fwnode_property_read_u32(child, "reg", ®)) @@ -347,10 +345,8 @@ static int msp430_leds_probe(struct spi_device *spi) } rc = msp430_led_probe(spi, child, reg); - if (rc < 0) { - fwnode_handle_put(child); + if (rc < 0) return rc; - } } return 0; diff --git a/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c b/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c index db7d6adb0ca..fdbfa5de53f 100644 --- a/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c +++ b/target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c @@ -166,7 +166,6 @@ static int srg_led_probe(struct i2c_client *client) { struct device *dev = &client->dev; - struct fwnode_handle *fw = dev_fwnode(dev); struct srg_led_ctrl *sysled_ctrl; int err; @@ -182,7 +181,7 @@ srg_led_probe(struct i2c_client *client) i2c_set_clientdata(client, sysled_ctrl); - fwnode_for_each_available_child_node_scoped(fw, child) { + device_for_each_child_node_scoped(dev, child) { if (srg_led_init_led(sysled_ctrl, child)) continue; diff --git a/target/linux/realtek/patches-6.18/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch b/target/linux/realtek/patches-6.18/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch index 48099890e40..c7670743dc0 100644 --- a/target/linux/realtek/patches-6.18/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch +++ b/target/linux/realtek/patches-6.18/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch @@ -50,7 +50,7 @@ Signed-off-by: Sander Vanheule obj-$(CONFIG_LEDS_SUN50I_A100) += leds-sun50i-a100.o --- /dev/null +++ b/drivers/leds/leds-rtl8231.c -@@ -0,0 +1,290 @@ +@@ -0,0 +1,289 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include @@ -288,7 +288,6 @@ Signed-off-by: Sander Vanheule +{ + struct device *dev = &pdev->dev; + const unsigned int *port_counts; -+ struct fwnode_handle *child; + struct regmap *map; + int err; + @@ -314,7 +313,7 @@ Signed-off-by: Sander Vanheule + if (err) + return err; + -+ fwnode_for_each_available_child_node(dev->fwnode, child) { ++ device_for_each_child_node_scoped(dev, child) { + err = rtl8231_led_probe_single(dev, map, port_counts, child); + if (err) + dev_warn(dev, "failed to register LED %pfwP", child);