]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
treewide: remove fwnode_for_each_available_child_node 24120/head
authorRosen Penev <rosenp@gmail.com>
Mon, 6 Jul 2026 06:57:33 +0000 (23:57 -0700)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Thu, 9 Jul 2026 07:33:41 +0000 (09:33 +0200)
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 <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24120
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c
target/linux/mediatek/files/drivers/leds/leds-smartrg-system.c
target/linux/realtek/patches-6.18/804-leds-Add-support-for-RTL8231-LED-scan-matrix.patch

index 65a27806f27a011fbb03b2de7d121c511a1a48c5..2aeacdbda8f5d204cca24028f0bb47f66e95c04b 100644 (file)
@@ -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", &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;
index db7d6adb0ca4b050c8b01bcf08e6ed3d5d6b8687..fdbfa5de53f92becf1995ac6446cdfddc11394d5 100644 (file)
@@ -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;
 
index 48099890e40fdd5e7ec6208c24b377bf719d4d5b..c7670743dc0996d77d630ebc80fb79bab7a4d50d 100644 (file)
@@ -50,7 +50,7 @@ Signed-off-by: Sander Vanheule <sander@svanheule.net>
  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 <linux/device.h>
@@ -288,7 +288,6 @@ Signed-off-by: Sander Vanheule <sander@svanheule.net>
 +{
 +      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 <sander@svanheule.net>
 +      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);