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>
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", ®))
}
rc = msp430_led_probe(spi, child, reg);
- if (rc < 0) {
- fwnode_handle_put(child);
+ if (rc < 0)
return rc;
- }
}
return 0;
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;
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;
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>
+{
+ struct device *dev = &pdev->dev;
+ const unsigned int *port_counts;
-+ struct fwnode_handle *child;
+ struct regmap *map;
+ int err;
+
+ 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);