Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <javier.carrasco.cruz@gmail.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Link: https://patch.msgid.link/20240820-device_child_node_access-v3-1-1ee09bdedb9e@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Javier Carrasco and committed by
Jonathan Cameron
31c022a4 192be245

+5 -10
+5 -10
drivers/iio/adc/xilinx-ams.c
··· 1275 1275 struct ams *ams = iio_priv(indio_dev); 1276 1276 struct iio_chan_spec *ams_channels, *dev_channels; 1277 1277 struct device *dev = indio_dev->dev.parent; 1278 - struct fwnode_handle *child = NULL; 1279 1278 struct fwnode_handle *fwnode = dev_fwnode(dev); 1280 1279 size_t ams_size; 1281 1280 int ret, ch_cnt = 0, i, rising_off, falling_off; ··· 1296 1297 num_channels += ret; 1297 1298 } 1298 1299 1299 - fwnode_for_each_child_node(fwnode, child) { 1300 - if (fwnode_device_is_available(child)) { 1301 - ret = ams_init_module(indio_dev, child, ams_channels + num_channels); 1302 - if (ret < 0) { 1303 - fwnode_handle_put(child); 1304 - return ret; 1305 - } 1300 + device_for_each_child_node_scoped(dev, child) { 1301 + ret = ams_init_module(indio_dev, child, ams_channels + num_channels); 1302 + if (ret < 0) 1303 + return ret; 1306 1304 1307 - num_channels += ret; 1308 - } 1305 + num_channels += ret; 1309 1306 } 1310 1307 1311 1308 for (i = 0; i < num_channels; i++) {