linux/const.h: move UL() macro to include/linux/const.h
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 10 Apr 2018 23:36:19 +0000 (16:36 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Apr 2018 17:28:38 +0000 (10:28 -0700)
ARM, ARM64 and UniCore32 duplicate the definition of UL():

  #define UL(x) _AC(x, UL)

This is not actually arch-specific, so it will be useful to move it to a
common header.  Currently, we only have the uapi variant for
linux/const.h, so I am creating include/linux/const.h.

I also added _UL(), _ULL() and ULL() because _AC() is mostly used in
the form either _AC(..., UL) or _AC(..., ULL).  I expect they will be
replaced in follow-up cleanups.  The underscore-prefixed ones should
be used for exported headers.

Link: http://lkml.kernel.org/r/1519301715-31798-4-git-send-email-yamada.masahiro@socionext.com
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm/include/asm/memory.h
arch/arm64/include/asm/memory.h
arch/unicore32/include/asm/memory.h
include/linux/const.h [new file with mode: 0644]
include/uapi/linux/const.h

index 4966677036937cf3417fc9eb6477f00710804b47..ed8fd0d19a3e10e7618b78a63169e9c41896760d 100644 (file)
 #include <mach/memory.h>
 #endif
 
-/*
- * Allow for constants defined here to be used from assembly code
- * by prepending the UL suffix only with actual C code compilation.
- */
-#define UL(x) _AC(x, UL)
-
 /* PAGE_OFFSET - the virtual address of the start of the kernel image */
 #define PAGE_OFFSET            UL(CONFIG_PAGE_OFFSET)
 
index 50fa96a497926178a010075701eea807a1b7e99d..49d99214f43c5011f2187fb5bc12c6d4537cd307 100644 (file)
 #include <asm/page-def.h>
 #include <asm/sizes.h>
 
-/*
- * Allow for constants defined here to be used from assembly code
- * by prepending the UL suffix only with actual C code compilation.
- */
-#define UL(x) _AC(x, UL)
-
 /*
  * Size of the PCI I/O space. This must remain a power of two so that
  * IO_SPACE_LIMIT acts as a mask for the low bits of I/O addresses.
index 3bb0a29fd2d7b11739e9a22247f4d2edaa1d9403..66bb9f6525c04ca427ae4d4440246106aa37dd9e 100644 (file)
 #include <asm/sizes.h>
 #include <mach/memory.h>
 
-/*
- * Allow for constants defined here to be used from assembly code
- * by prepending the UL suffix only with actual C code compilation.
- */
-#define UL(x) _AC(x, UL)
-
 /*
  * PAGE_OFFSET - the virtual address of the start of the kernel image
  * TASK_SIZE - the maximum size of a user space task.
diff --git a/include/linux/const.h b/include/linux/const.h
new file mode 100644 (file)
index 0000000..7b55a55
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef _LINUX_CONST_H
+#define _LINUX_CONST_H
+
+#include <uapi/linux/const.h>
+
+#define UL(x)          (_UL(x))
+#define ULL(x)         (_ULL(x))
+
+#endif /* _LINUX_CONST_H */
index c5a60ebabf5e669c1be7c3b87ccf5ceb6d1c61a1..09bc0e0e97e31adbf2c1a2e8cad6df6d5dfbcda4 100644 (file)
@@ -22,6 +22,9 @@
 #define _AT(T,X)       ((T)(X))
 #endif
 
+#define _UL(x)         (_AC(x, UL))
+#define _ULL(x)                (_AC(x, ULL))
+
 #define _BITUL(x)      (_AC(1,UL) << (x))
 #define _BITULL(x)     (_AC(1,ULL) << (x))