summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2020-05-04 23:24:53 +0900
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-05 07:56:26 +0200
commit04e2aa516ed571caf7fb32f6f5b9682d2cd41b5d (patch)
tree1907e03d9f993939045143409053f77409e919a8 /common
parent81ca755487bae340841cd2fa00f7539a9ed272a7 (diff)
downloadbarebox-04e2aa516ed571caf7fb32f6f5b9682d2cd41b5d.tar.gz
barebox-04e2aa516ed571caf7fb32f6f5b9682d2cd41b5d.tar.xz
common.h: move and rename lregion_overlap()
lregion_overlap() is only used by common/startup.c There is no need to define it in include/common.h While I was here, I also renamed it to region_overlap(), and got rid of the 'inline' keyword. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/startup.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/common/startup.c b/common/startup.c
index 2c3a999e10..511675ed55 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -74,6 +74,16 @@ fs_initcall(mount_root);
#endif
#ifdef CONFIG_ENV_HANDLING
+static bool region_overlap(loff_t starta, loff_t lena,
+ loff_t startb, loff_t lenb)
+{
+ if (starta + lena <= startb)
+ return 0;
+ if (startb + lenb <= starta)
+ return 0;
+ return 1;
+}
+
static int check_overlap(const char *path)
{
struct cdev *cenv, *cdisk, *cpart;
@@ -104,8 +114,8 @@ static int check_overlap(const char *path)
if (cpart == cenv)
continue;
- if (lregion_overlap(cpart->offset, cpart->size,
- cenv->offset, cenv->size))
+ if (region_overlap(cpart->offset, cpart->size,
+ cenv->offset, cenv->size))
goto conflict;
}