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.

of/address: introduce of_address_count() helper

Introduce of_address_count() helper to count the IO resources
instead of open-coding it.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221008115617.3583890-2-yangyingliang@huawei.com
Signed-off-by: Rob Herring <robh@kernel.org>

authored by

Yang Yingliang and committed by
Rob Herring
16988c74 9abf2313

+11
+11
include/linux/of_address.h
··· 154 154 return __of_get_address(dev, -1, bar_no, size, flags); 155 155 } 156 156 157 + static inline int of_address_count(struct device_node *np) 158 + { 159 + struct resource res; 160 + int count = 0; 161 + 162 + while (of_address_to_resource(np, count, &res) == 0) 163 + count++; 164 + 165 + return count; 166 + } 167 + 157 168 #endif /* __OF_ADDRESS_H */