Skip to contentSkip to conversation

common.h: remove unused region_overlap()

PATCH Applied Masahiro Yamada 2 participants 5 messages May 4, 2020 – May 5, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 common.h: remove unused region_overlap()

This is not used at all.

---

 include/common.h | 9 ---------
 1 file changed, 9 deletions(-)
include/common.h +0 -9
index d73fc3d13..3570e6aba 100644
@@ -142,15 +142,6 @@ void barebox_set_hostname_no_overwrite(const char *);
 /*
  * Check if two regions overlap. returns true if they do, false otherwise
  */
-static inline bool 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;
-}
 
 static inline bool lregion_overlap(loff_t starta, loff_t lena,
 				   loff_t startb, loff_t lenb)
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/4 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.

---

 common/startup.c | 14 ++++++++++++--
 include/common.h | 14 --------------
 2 files changed, 12 insertions(+), 16 deletions(-)
common/startup.c +12 -2
index 2c3a999e1..511675ed5 100644
@@ -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;
 	}
 
include/common.h +0 -14
index 3570e6aba..0bf819a6f 100644
@@ -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_ */
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/4 nios2: include <asm-generic/io.h> from asm/io.h

In reply to Masahiro Yamada

<asm-generic/io.h> is a collection of default of various accessors.

All the other architectures include <asm-generic/io.h> as a fallback. Do likewise for NIOS2.

---

 arch/nios2/include/asm/io.h | 2 ++
 1 file changed, 2 insertions(+)
arch/nios2/include/asm/io.h +2 -0
index 360d786ea..a964c695e 100644
@@ -46,4 +46,6 @@
 #define writel(val, addr)\
 	asm volatile("stwio %0, 0(%1)" : : "r" (val), "r" (addr))
 
+#include <asm-generic/io.h>
+
 #endif /* __ASM_NIOS2_IO_H_ */
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 4/4 common.h: move the generic IOMEM definition to asm-generic/io.h

In reply to Masahiro Yamada

arch/mips/include/asm/io.h defines arch-specific IOMEM().

The generic definition of IOMEM() should go to asm-generic/io.h because it is a collection of fallback defaults when there is no specific definition in <asm/io.h>.

---

 include/asm-generic/io.h | 4 ++++
 include/common.h         | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
include/asm-generic/io.h +4 -0
index 973b8b954..76e6d0dc1 100644
@@ -420,4 +420,8 @@ static inline void iowrite64be(u64 value, volatile void __iomem *addr)
 #endif
 #endif /* CONFIG_64BIT */
 
+#ifndef IOMEM
+#define IOMEM(addr)	((void __force __iomem *)(addr))
+#endif
+
 #endif /* __ASM_GENERIC_IO_H */
include/common.h +0 -4
index 0bf819a6f..ce16ff83a 100644
@@ -135,8 +135,4 @@ const char *barebox_get_hostname(void);
 void barebox_set_hostname(const char *);
 void barebox_set_hostname_no_overwrite(const char *);
 
-#ifndef IOMEM
-#define IOMEM(addr)	((void __force __iomem *)(addr))
-#endif
-
 #endif	/* __COMMON_H_ */
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#4 lore raw
In reply to Masahiro Yamada
Quoted 7 lines · Masahiro Yamada

This is not used at all.

---

 include/common.h | 9 ---------
 1 file changed, 9 deletions(-)

Applied, thanks

Sascha

Quoted 30 lines
include/common.h +0 -9
index d73fc3d13..3570e6aba 100644
@@ -142,15 +142,6 @@ void barebox_set_hostname_no_overwrite(const char *);
 /*
  * Check if two regions overlap. returns true if they do, false otherwise
  */
-static inline bool 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;
-}
 
 static inline bool lregion_overlap(loff_t starta, loff_t lena,
 				   loff_t startb, loff_t lenb)
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox