mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: barebox@lists.infradead.org
Cc: Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 2/4] common.h: move and rename lregion_overlap()
Date: Mon,  4 May 2020 23:24:53 +0900	[thread overview]
Message-ID: <20200504142455.404658-2-masahiroy@kernel.org> (raw)
In-Reply-To: <20200504142455.404658-1-masahiroy@kernel.org>

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>
---

 common/startup.c | 14 ++++++++++++--
 include/common.h | 14 --------------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index 2c3a999e1..511675ed5 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;
 	}
 
diff --git a/include/common.h b/include/common.h
index 3570e6aba..0bf819a6f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -139,18 +139,4 @@ void barebox_set_hostname_no_overwrite(const char *);
 #define IOMEM(addr)	((void __force __iomem *)(addr))
 #endif
 
-/*
- * Check if two regions overlap. returns true if they do, false otherwise
- */
-
-static inline bool lregion_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;
-}
-
 #endif	/* __COMMON_H_ */
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-05-04 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 14:24 [PATCH 1/4] common.h: remove unused region_overlap() Masahiro Yamada
2020-05-04 14:24 ` Masahiro Yamada [this message]
2020-05-04 14:24 ` [PATCH 3/4] nios2: include <asm-generic/io.h> from asm/io.h Masahiro Yamada
2020-05-04 14:24 ` [PATCH 4/4] common.h: move the generic IOMEM definition to asm-generic/io.h Masahiro Yamada
2020-05-05  5:56 ` [PATCH 1/4] common.h: remove unused region_overlap() Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200504142455.404658-2-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox