[U-Boot] [PATCH 1/2] sandbox: remove CONFIG_SANDBOX_BITS_PER_LONG and GENMASK hack

Masahiro Yamada yamada.masahiro at socionext.com
Thu Jun 27 09:14:59 UTC 2019


Commit e519c616061d ("bitops: Fix GENMASK definition for Sandbox")
is wrong.

BITS_PER_LONG must match to sizeof(long) of the compiler. If not,
we are already totally screwed up.

It is weird to patch GENMASK() only.

Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---

 arch/sandbox/Kconfig                   | 5 -----
 arch/sandbox/include/asm/io.h          | 4 ----
 arch/sandbox/include/asm/posix_types.h | 2 +-
 arch/sandbox/include/asm/types.h       | 2 +-
 include/linux/bitops.h                 | 5 -----
 5 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 2a08533c4b59..977170b4ab84 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -41,9 +41,4 @@ config HOST_64BIT
 
 endchoice
 
-config SANDBOX_BITS_PER_LONG
-	int
-	default 32 if HOST_32BIT
-	default 64 if HOST_64BIT
-
 endmenu
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 2a350a826c4b..fb2dd23d4659 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -42,15 +42,11 @@ phys_addr_t map_to_sysmem(const void *ptr);
 #define readb(addr) ((void)addr, 0)
 #define readw(addr) ((void)addr, 0)
 #define readl(addr) ((void)addr, 0)
-#ifdef CONFIG_SANDBOX64
 #define readq(addr) ((void)addr, 0)
-#endif
 #define writeb(v, addr) ((void)addr)
 #define writew(v, addr) ((void)addr)
 #define writel(v, addr) ((void)addr)
-#ifdef CONFIG_SANDBOX64
 #define writeq(v, addr) ((void)addr)
-#endif
 
 /*
  * Clear and set bits in one shot. These macros can be used to clear and
diff --git a/arch/sandbox/include/asm/posix_types.h b/arch/sandbox/include/asm/posix_types.h
index ec18ed7e3c29..00e313bc08b3 100644
--- a/arch/sandbox/include/asm/posix_types.h
+++ b/arch/sandbox/include/asm/posix_types.h
@@ -28,7 +28,7 @@ typedef int			__kernel_pid_t;
 typedef unsigned short		__kernel_ipc_pid_t;
 typedef unsigned short		__kernel_uid_t;
 typedef unsigned short		__kernel_gid_t;
-#if CONFIG_SANDBOX_BITS_PER_LONG == 32
+#ifdef CONFIG_HOST_32BIT
 typedef unsigned int		__kernel_size_t;
 typedef int			__kernel_ssize_t;
 typedef int			__kernel_ptrdiff_t;
diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h
index c1a5d2af8285..8fc3877fe1bc 100644
--- a/arch/sandbox/include/asm/types.h
+++ b/arch/sandbox/include/asm/types.h
@@ -18,7 +18,7 @@ typedef unsigned short umode_t;
 /*
  * Number of bits in a C 'long' on this architecture.
  */
-#ifdef	CONFIG_PHYS_64BIT
+#ifdef	CONFIG_HOST_64BIT
 #define BITS_PER_LONG 64
 #else	/* CONFIG_PHYS_64BIT */
 #define BITS_PER_LONG 32
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 259df43fb00f..a47f6d17bb5f 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -21,13 +21,8 @@
  * position @h. For example
  * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
  */
-#ifdef CONFIG_SANDBOX
-#define GENMASK(h, l) \
-	(((~0UL) << (l)) & (~0UL >> (CONFIG_SANDBOX_BITS_PER_LONG - 1 - (h))))
-#else
 #define GENMASK(h, l) \
 	(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
-#endif
 
 #define GENMASK_ULL(h, l) \
 	(((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
-- 
2.17.1



More information about the U-Boot mailing list