Skip to content

Commit 77b2b47

Browse files
javiercarrascocruzlag-linaro
authored andcommitted
leds: as3645a: Use device_* to iterate over device child nodes
Drop the manual access to the fwnode of the device to iterate over its child nodes. `device_for_each_child_node` macro provides direct access to the child nodes, and given that the `child` variable is only required within the loop, the scoped variant of the macro can be used. Use the `device_for_each_child_node_scoped` macro to iterate over the direct child nodes of the device. Signed-off-by: Javier Carrasco <[email protected]> Acked-by: Sakari Ailus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 9557b43 commit 77b2b47

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/leds/flash/leds-as3645a.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,12 @@ static int as3645a_detect(struct as3645a *flash)
478478
return as3645a_write(flash, AS_BOOST_REG, AS_BOOST_CURRENT_DISABLE);
479479
}
480480

481-
static int as3645a_parse_node(struct as3645a *flash,
482-
struct fwnode_handle *fwnode)
481+
static int as3645a_parse_node(struct device *dev, struct as3645a *flash)
483482
{
484483
struct as3645a_config *cfg = &flash->cfg;
485-
struct fwnode_handle *child;
486484
int rval;
487485

488-
fwnode_for_each_child_node(fwnode, child) {
486+
device_for_each_child_node_scoped(dev, child) {
489487
u32 id = 0;
490488

491489
fwnode_property_read_u32(child, "reg", &id);
@@ -686,7 +684,7 @@ static int as3645a_probe(struct i2c_client *client)
686684

687685
flash->client = client;
688686

689-
rval = as3645a_parse_node(flash, dev_fwnode(&client->dev));
687+
rval = as3645a_parse_node(&client->dev, flash);
690688
if (rval < 0)
691689
return rval;
692690

0 commit comments

Comments
 (0)