Skip to content

Commit 31c022a

Browse files
javiercarrascocruzjic23
authored andcommitted
iio: adc: xilinx-ams: use device_* to iterate over device child nodes
Use `device_for_each_child_node_scoped()` in `ams_parse_firmware()` to explicitly state device child node access, and simplify the child node handling as it is not required outside the loop. Signed-off-by: Javier Carrasco <[email protected]> Reviewed-by: Mike Leach <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 192be24 commit 31c022a

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/iio/adc/xilinx-ams.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
12751275
struct ams *ams = iio_priv(indio_dev);
12761276
struct iio_chan_spec *ams_channels, *dev_channels;
12771277
struct device *dev = indio_dev->dev.parent;
1278-
struct fwnode_handle *child = NULL;
12791278
struct fwnode_handle *fwnode = dev_fwnode(dev);
12801279
size_t ams_size;
12811280
int ret, ch_cnt = 0, i, rising_off, falling_off;
@@ -1297,16 +1296,12 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
12971296
num_channels += ret;
12981297
}
12991298

1300-
fwnode_for_each_child_node(fwnode, child) {
1301-
if (fwnode_device_is_available(child)) {
1302-
ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
1303-
if (ret < 0) {
1304-
fwnode_handle_put(child);
1305-
return ret;
1306-
}
1299+
device_for_each_child_node_scoped(dev, child) {
1300+
ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
1301+
if (ret < 0)
1302+
return ret;
13071303

1308-
num_channels += ret;
1309-
}
1304+
num_channels += ret;
13101305
}
13111306

13121307
for (i = 0; i < num_channels; i++) {

0 commit comments

Comments
 (0)