Skip to content

Commit 00977af

Browse files
committed
of: kunit: Extract some overlay boiler plate into macros
Make the lives of __of_overlay_apply_kunit() callers easier by extracting some of the boiler plate involved in referencing the DT overlays. Cc: Brendan Higgins <[email protected]> Cc: David Gow <[email protected]> Cc: Rae Moar <[email protected]> Cc: Peng Fan <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a82fcb1 commit 00977af

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

include/kunit/of.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ static inline int __of_overlay_apply_kunit(struct kunit *test,
6262
&unused);
6363
}
6464

65+
#define of_overlay_begin(overlay_name) __dtbo_##overlay_name##_begin
66+
#define of_overlay_end(overlay_name) __dtbo_##overlay_name##_end
67+
68+
#define OF_OVERLAY_DECLARE(overlay_name) \
69+
extern uint8_t of_overlay_begin(overlay_name)[]; \
70+
extern uint8_t of_overlay_end(overlay_name)[] \
71+
6572
/**
6673
* of_overlay_apply_kunit() - Test managed of_overlay_fdt_apply() for built-in overlays
6774
* @test: test context
@@ -104,12 +111,11 @@ static inline int __of_overlay_apply_kunit(struct kunit *test,
104111
*/
105112
#define of_overlay_apply_kunit(test, overlay_name) \
106113
({ \
107-
extern uint8_t __dtbo_##overlay_name##_begin[]; \
108-
extern uint8_t __dtbo_##overlay_name##_end[]; \
114+
OF_OVERLAY_DECLARE(overlay_name); \
109115
\
110116
__of_overlay_apply_kunit((test), \
111-
__dtbo_##overlay_name##_begin, \
112-
__dtbo_##overlay_name##_end); \
117+
of_overlay_begin(overlay_name), \
118+
of_overlay_end(overlay_name)); \
113119
})
114120

115121
#endif

0 commit comments

Comments
 (0)