From patchwork Wed Jan 4 08:55:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 89786 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8394440qgi; Wed, 4 Jan 2017 00:58:37 -0800 (PST) X-Received: by 10.84.213.150 with SMTP id g22mr143414362pli.11.1483520317863; Wed, 04 Jan 2017 00:58:37 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id l4si1946723plk.130.2017.01.04.00.58.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jan 2017 00:58:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOhOB-00017X-BX; Wed, 04 Jan 2017 08:57:43 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cOhNq-0000z8-Kw for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2017 08:57:25 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id v048u1dI002604; Wed, 4 Jan 2017 17:56:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v048u1dI002604 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1483520165; bh=z8UjvJK43RkPgzuQUXpLShgJ2wct5V/ditvl9YNY9bU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rTRL1BEyLdzx/XsaHxANYYlaj86WeoU7OzdinfMGedDwQQ1xDywWLoZTv/vZdZASF p21F3J06mh4zdXx2sHuRTU86zUBzWMSfvAn6/bP+N8FDxQOF4yq9/8m4fNPJ0mPXxb njhyTsg32eyE5Bn6Ns3CMcURcURgTNG4qPQaRBZigPMxuTIK5+zebsfVN2qsXNWnoq nraybLNxM1wHaXCi/UW7tVnK63e9jmspaqvHviYpiC6ZovJrD/56LDcL1JFD038e2y yVSfvYNOP+aEn003boc8U0NbHcBIix/OEiM7Y1D6BA0IbBQH/tvRfj7AZfNAhMCg5s IgYm5MdNynA4Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Andrew Morton Subject: [PATCH 1/3] linux/const.h: move UL() macro to include/linux/const.h Date: Wed, 4 Jan 2017 17:55:25 +0900 Message-Id: <1483520127-29316-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483520127-29316-1-git-send-email-yamada.masahiro@socionext.com> References: <1483520127-29316-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170104_005722_980085_773C27EB X-CRM114-Status: GOOD ( 18.39 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Nicolas Pitre , Catalin Marinas , Srinivas Pandruvada , Will Deacon , David Howells , Masahiro Yamada , Chris Brandt , "H . Peter Anvin" , Guan Xuetao , x86@kernel.org, Russell King , Ingo Molnar , Geert Uytterhoeven , Laura Abbott , Neeraj Upadhyay , Arnd Bergmann , linux-m68k@lists.linux-m68k.org, Santosh Shilimkar , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , linux-kernel@vger.kernel.org, James Morse , Olof Johansson MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Some architectures are duplicating 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(x), _ULL(x), ULL(x) because _AC() is used for UL in most places (and ULL in some places). I expect _AC(..., UL) will be replaced with _UL(...) or UL(...). The underscore-prefixed one should be used for exported headers. Note: I renamed UL(x) in arch/m68k/mm/init.c, where it is used for a different meaning. Signed-off-by: Masahiro Yamada --- arch/arm/include/asm/memory.h | 6 ------ arch/arm64/include/asm/memory.h | 6 ------ arch/m68k/mm/init.c | 6 +++--- arch/unicore32/include/asm/memory.h | 6 ------ include/linux/const.h | 9 +++++++++ include/uapi/linux/const.h | 9 ++++++--- 6 files changed, 18 insertions(+), 24 deletions(-) create mode 100644 include/linux/const.h -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel Acked-by: Guan Xuetao 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 #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 /* - * 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/m68k/mm/init.c b/arch/m68k/mm/init.c index 9c1e656..a625144 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c @@ -121,9 +121,9 @@ void free_initmem(void) void __init print_memmap(void) { -#define UL(x) ((unsigned long) (x)) -#define MLK(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 10 -#define MLM(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 20 +#define TO_UL(x) ((unsigned long) (x)) +#define MLK(b, t) TO_UL(b), TO_UL(t), (TO_UL(t) - TO_UL(b)) >> 10 +#define MLM(b, t) TO_UL(b), TO_UL(t), (TO_UL(t) - TO_UL(b)) >> 20 #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), 1024) pr_notice("Virtual kernel memory layout:\n" 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 /* - * 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 + +#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 */