[PATCH v2 064/113] boarddata: add barebox_boarddata_is_machine helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In a later commit, the same barebox binary may be used either as EFI payload
or as EFI loader being initialized from the device tree. The
difference will be the barebox_boarddata, so add a helper for checking
it.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/boarddata.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/boarddata.h b/include/boarddata.h
index 68ad0d146495..8c048fd957b4 100644
--- a/include/boarddata.h
+++ b/include/boarddata.h
@@ -38,4 +38,12 @@ static inline struct barebox_boarddata *boarddata_create(void *adr, u32 machine)
 
 const struct barebox_boarddata *barebox_get_boarddata(void);
 
+static inline bool barebox_boarddata_is_machine(const struct barebox_boarddata *bd,
+						u32 machine)
+{
+	if (!bd || bd->magic != BAREBOX_BOARDDATA_MAGIC)
+		return false;
+	return bd->machine == machine;
+}
+
 #endif	/* _BAREBOX_BOARDDATA_H_ */
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux