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]
This commit is contained in:
Stephen Boyd committed 2024-10-09 16:25:32 -07:00
1 parent a82fcb16d9
commit 00977af421
1 file changed
+10 -4
+10 -4
View File
@@ -62,6 +62,13 @@ static inline int __of_overlay_apply_kunit(struct kunit *test,
&unused);
}
#define of_overlay_begin(overlay_name) __dtbo_##overlay_name##_begin
#define of_overlay_end(overlay_name) __dtbo_##overlay_name##_end
#define OF_OVERLAY_DECLARE(overlay_name) \
extern uint8_t of_overlay_begin(overlay_name)[]; \
extern uint8_t of_overlay_end(overlay_name)[] \
/**
* of_overlay_apply_kunit() - Test managed of_overlay_fdt_apply() for built-in overlays
* @test: test context
@@ -104,12 +111,11 @@ static inline int __of_overlay_apply_kunit(struct kunit *test,
*/
#define of_overlay_apply_kunit(test, overlay_name) \
({ \
extern uint8_t __dtbo_##overlay_name##_begin[]; \
extern uint8_t __dtbo_##overlay_name##_end[]; \
OF_OVERLAY_DECLARE(overlay_name); \
\
__of_overlay_apply_kunit((test), \
__dtbo_##overlay_name##_begin, \
__dtbo_##overlay_name##_end); \
of_overlay_begin(overlay_name), \
of_overlay_end(overlay_name)); \
})
#endif