Skip to content

Commit

Permalink
linux/const.h: move UL() macro to include/linux/const.h
Browse files Browse the repository at this point in the history
commit 2dd8a62 upstream.

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>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Masahiro Yamada authored and Greg Kroah-Hartman committed Nov 10, 2022
1 parent 0ad721c commit 6bd6be6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
6 changes: 0 additions & 6 deletions arch/arm/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 0 additions & 6 deletions arch/arm64/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
#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.
Expand Down
6 changes: 0 additions & 6 deletions arch/unicore32/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
#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.
Expand Down
9 changes: 9 additions & 0 deletions include/linux/const.h
Original file line number Diff line number Diff line change
@@ -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 */
3 changes: 3 additions & 0 deletions include/uapi/linux/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 6bd6be6

Please sign in to comment.