projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9abf231
)
of/address: introduce of_address_count() helper
author
Yang Yingliang
<yangyingliang@huawei.com>
Sat, 8 Oct 2022 11:56:16 +0000
(19:56 +0800)
committer
Rob Herring
<robh@kernel.org>
Sun, 16 Oct 2022 22:58:54 +0000
(17:58 -0500)
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>
include/linux/of_address.h
patch
|
blob
|
history
diff --git
a/include/linux/of_address.h
b/include/linux/of_address.h
index
45598db
..
265f26e
100644
(file)
--- a/
include/linux/of_address.h
+++ b/
include/linux/of_address.h
@@
-154,4
+154,15
@@
static inline const __be32 *of_get_pci_address(struct device_node *dev, int bar_
return __of_get_address(dev, -1, bar_no, size, flags);
}
+static inline int of_address_count(struct device_node *np)
+{
+ struct resource res;
+ int count = 0;
+
+ while (of_address_to_resource(np, count, &res) == 0)
+ count++;
+
+ return count;
+}
+
#endif /* __OF_ADDRESS_H */