Skip to content

Commit daca644

Browse files
javiercarrascocruzSuzuki K Poulose
authored andcommitted
coresight: cti: 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 they are 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]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 47ac09b commit daca644

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/hwtracing/coresight/coresight-cti-platform.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,20 +416,16 @@ static int cti_plat_create_impdef_connections(struct device *dev,
416416
struct cti_drvdata *drvdata)
417417
{
418418
int rc = 0;
419-
struct fwnode_handle *fwnode = dev_fwnode(dev);
420-
struct fwnode_handle *child = NULL;
421419

422-
if (IS_ERR_OR_NULL(fwnode))
420+
if (IS_ERR_OR_NULL(dev_fwnode(dev)))
423421
return -EINVAL;
424422

425-
fwnode_for_each_child_node(fwnode, child) {
423+
device_for_each_child_node_scoped(dev, child) {
426424
if (cti_plat_node_name_eq(child, CTI_DT_CONNS))
427-
rc = cti_plat_create_connection(dev, drvdata,
428-
child);
425+
rc = cti_plat_create_connection(dev, drvdata, child);
429426
if (rc != 0)
430427
break;
431428
}
432-
fwnode_handle_put(child);
433429

434430
return rc;
435431
}

0 commit comments

Comments
 (0)