From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "H . Peter Anvin" <hpa@zytor.com>, Arnd Bergmann <arnd@arndb.de>,
David Howells <dhowells@redhat.com>,
x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Russell King <linux@armlinux.org.uk>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will.deacon@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Olof Johansson <olof@lixom.net>,
Catalin Marinas <catalin.marinas@arm.com>,
linux-arm-kernel@lists.infradead.org,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Alexander Popov <alex.popov@linux.com>,
Neeraj Upadhyay <neeraju@codeaurora.org>,
James Morse <james.morse@arm.com>,
linux-kernel@vger.kernel.org,
Santosh Shilimkar <ssantosh@kernel.org>,
Laura Abbott <labbott@redhat.com>,
Guan Xuetao <gxt@mprc.pku.edu.cn>,
Nicolas Pitre <nicolas.pitre@linaro.org>,
Pratyush Anand <panand@redhat.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h
Date: Thu, 5 Jan 2017 11:20:07 +0900 [thread overview]
Message-ID: <1483582810-7046-3-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1483582810-7046-1-git-send-email-yamada.masahiro@socionext.com>
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 am also adding _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 later cleanups. The underscore-prefixed
ones should be used for exported headers.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
---
Changes in v2: None
arch/arm/include/asm/memory.h | 6 ------
arch/arm64/include/asm/memory.h | 6 ------
arch/unicore32/include/asm/memory.h | 6 ------
include/linux/const.h | 9 +++++++++
include/uapi/linux/const.h | 9 ++++++---
5 files changed, 15 insertions(+), 21 deletions(-)
create mode 100644 include/linux/const.h
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 76cbd9c..7558247 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -22,12 +22,6 @@
#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)
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index bfe6328..4310bcc 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -28,12 +28,6 @@
#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.
*/
diff --git a/arch/unicore32/include/asm/memory.h b/arch/unicore32/include/asm/memory.h
index 3bb0a29..66bb9f6 100644
--- a/arch/unicore32/include/asm/memory.h
+++ b/arch/unicore32/include/asm/memory.h
@@ -20,12 +20,6 @@
#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.
* TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
diff --git a/include/linux/const.h b/include/linux/const.h
new file mode 100644
index 0000000..7b55a55
--- /dev/null
+++ b/include/linux/const.h
@@ -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 */
diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h
index c872bfd..76fb0f9 100644
--- a/include/uapi/linux/const.h
+++ b/include/uapi/linux/const.h
@@ -1,7 +1,7 @@
/* const.h: Macros for dealing with constants. */
-#ifndef _LINUX_CONST_H
-#define _LINUX_CONST_H
+#ifndef _UAPI_LINUX_CONST_H
+#define _UAPI_LINUX_CONST_H
/* Some constant macros are used in both assembler and
* C code. Therefore we cannot annotate them always with
@@ -21,7 +21,10 @@
#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))
-#endif /* !(_LINUX_CONST_H) */
+#endif /* _UAPI_LINUX_CONST_H */
--
2.7.4
next prev parent reply other threads:[~2017-01-05 2:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 2:20 [PATCH v2 0/4] linux/const.h: cleanups of macros such as UL(), _BITUL(), BIT() etc Masahiro Yamada
2017-01-05 2:20 ` [PATCH v2 1/4] m68k: rename UL() to TO_UL() Masahiro Yamada
2017-01-05 2:20 ` Masahiro Yamada [this message]
2017-01-05 11:18 ` [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h Catalin Marinas
2017-01-05 11:24 ` Russell King - ARM Linux
2017-01-05 2:20 ` [PATCH v2 3/4] linux/const.h: refactor _BITUL and _BITULL a bit Masahiro Yamada
2017-01-05 2:20 ` [PATCH v2 4/4] linux/const.h: move BIT(_ULL) to linux/const.h for use in assembly Masahiro Yamada
2017-01-06 10:45 ` [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h David Howells
2017-01-08 6:27 ` Masahiro Yamada
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=1483582810-7046-3-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=akpm@linux-foundation.org \
--cc=alex.popov@linux.com \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=dhowells@redhat.com \
--cc=gxt@mprc.pku.edu.cn \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=labbott@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=neeraju@codeaurora.org \
--cc=nicolas.pitre@linaro.org \
--cc=olof@lixom.net \
--cc=panand@redhat.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=ssantosh@kernel.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).