Skip to content

Commit aad70d5

Browse files
Revert "adt: drop ADT_FOREACH_PROPERTY"
This reverts commit 4be960c. Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
1 parent 492a991 commit aad70d5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/adt.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ bool adt_is_compatible_at(const void *adt, int nodeoffset, const char *compat, s
6767
for (node = adt_first_child_offset(adt, node); _child_count--; \
6868
node = adt_next_sibling_offset(adt, node))
6969

70+
#define ADT_FOREACH_PROPERTY(adt, node, prop) \
71+
for (int _prop_count = adt_get_property_count(adt, node), \
72+
_poff = adt_first_property_offset(adt, node); \
73+
_prop_count; _prop_count = 0) \
74+
for (const struct adt_property *prop = ADT_PROP(adt, _poff); _prop_count--; \
75+
prop = ADT_PROP(adt, _poff = adt_next_property_offset(adt, _poff)))
76+
7077
/* Common ADT properties */
7178
struct adt_segment_ranges {
7279
u64 phys;

0 commit comments

Comments
 (0)