* [PATCH 2/4] common.h: move and rename lregion_overlap()
2020-05-04 14:24 [PATCH 1/4] common.h: remove unused region_overlap() Masahiro Yamada
@ 2020-05-04 14:24 ` Masahiro Yamada
2020-05-04 14:24 ` [PATCH 3/4] nios2: include <asm-generic/io.h> from asm/io.h Masahiro Yamada
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2020-05-04 14:24 UTC (permalink / raw)
To: barebox; +Cc: Masahiro Yamada
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] nios2: include <asm-generic/io.h> from asm/io.h
2020-05-04 14:24 [PATCH 1/4] common.h: remove unused region_overlap() Masahiro Yamada
2020-05-04 14:24 ` [PATCH 2/4] common.h: move and rename lregion_overlap() Masahiro Yamada
@ 2020-05-04 14:24 ` 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
3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2020-05-04 14:24 UTC (permalink / raw)
To: barebox; +Cc: 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.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
arch/nios2/include/asm/io.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index 360d786ea..a964c695e 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -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_ */
--
2.25.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] common.h: move the generic IOMEM definition to asm-generic/io.h
2020-05-04 14:24 [PATCH 1/4] common.h: remove unused region_overlap() Masahiro Yamada
2020-05-04 14:24 ` [PATCH 2/4] common.h: move and rename lregion_overlap() Masahiro Yamada
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 ` Masahiro Yamada
2020-05-05 5:56 ` [PATCH 1/4] common.h: remove unused region_overlap() Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2020-05-04 14:24 UTC (permalink / raw)
To: barebox; +Cc: 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>.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
include/asm-generic/io.h | 4 ++++
include/common.h | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 973b8b954..76e6d0dc1 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -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 */
diff --git a/include/common.h b/include/common.h
index 0bf819a6f..ce16ff83a 100644
--- a/include/common.h
+++ b/include/common.h
@@ -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_ */
--
2.25.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] common.h: remove unused region_overlap()
2020-05-04 14:24 [PATCH 1/4] common.h: remove unused region_overlap() Masahiro Yamada
` (2 preceding siblings ...)
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 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-05-05 5:56 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: barebox
On Mon, May 04, 2020 at 11:24:52PM +0900, Masahiro Yamada wrote:
> This is not used at all.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> include/common.h | 9 ---------
> 1 file changed, 9 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/include/common.h b/include/common.h
> index d73fc3d13..3570e6aba 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -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)
> --
> 2.25.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread