]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
coresight: cti: use device_* to iterate over device child nodes
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Thu, 8 Aug 2024 15:12:37 +0000 (17:12 +0200)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 19 Aug 2024 14:31:37 +0000 (15:31 +0100)
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 <javier.carrasco.cruz@gmail.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20240808-device_child_node_access-v2-1-fc757cc76650@gmail.com
drivers/hwtracing/coresight/coresight-cti-platform.c

index ccef04f27f12faecd0c8e236f5ba479735a01ae8..d0ae10bf6128116900acb0e65d44952996753e79 100644 (file)
@@ -416,20 +416,16 @@ static int cti_plat_create_impdef_connections(struct device *dev,
                                              struct cti_drvdata *drvdata)
 {
        int rc = 0;
-       struct fwnode_handle *fwnode = dev_fwnode(dev);
-       struct fwnode_handle *child = NULL;
 
-       if (IS_ERR_OR_NULL(fwnode))
+       if (IS_ERR_OR_NULL(dev_fwnode(dev)))
                return -EINVAL;
 
-       fwnode_for_each_child_node(fwnode, child) {
+       device_for_each_child_node_scoped(dev, child) {
                if (cti_plat_node_name_eq(child, CTI_DT_CONNS))
-                       rc = cti_plat_create_connection(dev, drvdata,
-                                                       child);
+                       rc = cti_plat_create_connection(dev, drvdata, child);
                if (rc != 0)
                        break;
        }
-       fwnode_handle_put(child);
 
        return rc;
 }