[PATCH 1/4] common.h: reintroduce region_overlap() as, old_region_overlap()

Peter Rosin peda at axentia.se
Fri Sep 17 15:39:01 PDT 2021


The region_overlap() function was removed as unused by patch
81ca755487 ("common.h: remove unused region_overlap()")
but only because the last user was prematurely removed by patch
070de908da ("ARM: remove PBL_FORCE_PIGGYDATA_COPY")

A clean reverts is not appropriate, as the previous name of
the function has been repurposed by patch
04e2aa516e ("common.h: move and rename lregion_overlap()")

Signed-off-by: Peter Rosin <peda at axentia.se>
---
 include/common.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/common.h b/include/common.h
index 693f5bf97029..10cf5f732cbf 100644
--- a/include/common.h
+++ b/include/common.h
@@ -137,4 +137,18 @@ const char *barebox_get_hostname(void);
 void barebox_set_hostname(const char *);
 void barebox_set_hostname_no_overwrite(const char *);
 
+/*
+ * Check if two regions overlap. returns true if they do, false otherwise
+ */
+
+static inline bool old_region_overlap(unsigned long starta, unsigned long lena,
+		unsigned long startb, unsigned long lenb)
+{
+	if (starta + lena <= startb)
+		return 0;
+	if (startb + lenb <= starta)
+		return 0;
+	return 1;
+}
+
 #endif	/* __COMMON_H_ */
-- 
2.20.1





More information about the barebox mailing list