Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1551569 > unrolled thread
| Started by | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| First post | 2017-01-05 03:30 +0100 |
| Last post | 2017-01-08 07:30 +0100 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-01-05 03:30 +0100
Re: [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h Catalin Marinas <catalin.marinas@arm.com> - 2017-01-05 12:20 +0100
Re: [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-01-05 12:40 +0100
Re: [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h David Howells <dhowells@redhat.com> - 2017-01-06 11:50 +0100
Re: [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-01-08 07:30 +0100
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2017-01-05 03:30 +0100 |
| Subject | [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h |
| Message-ID | <sW5Yu-4QA-5@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Catalin Marinas <catalin.marinas@arm.com> |
|---|---|
| Date | 2017-01-05 12:20 +0100 |
| Subject | Re: [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h |
| Message-ID | <sWefo-2gj-15@gated-at.bofh.it> |
| In reply to | #1551569 |
> 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. > */ For the arm64 bit: Acked-by: Catalin Marinas <catalin.marinas@arm.com>
[toc] | [prev] | [next] | [standalone]
| From | Russell King - ARM Linux <linux@armlinux.org.uk> |
|---|---|
| Date | 2017-01-05 12:40 +0100 |
| Subject | Re: [PATCH v2 2/4] linux/const.h: move UL() macro to include/linux/const.h |
| Message-ID | <sWeyJ-2mW-15@gated-at.bofh.it> |
| In reply to | #1551569 |
On Thu, Jan 05, 2017 at 11:20:07AM +0900, Masahiro Yamada wrote: > 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) > For ARM, Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Thanks. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
[toc] | [prev] | [next] | [standalone]
| From | David Howells <dhowells@redhat.com> |
|---|---|
| Date | 2017-01-06 11:50 +0100 |
| Message-ID | <sWAfT-w2-1@gated-at.bofh.it> |
| In reply to | #1551569 |
Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > 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 You need to be very careful doing this. Some userspace stuff depends on the guard macro names on the kernel header files. > /* 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)) How likely is this to collide with existing userspace code somewhere? It looks like the sort of thing that could collide with a C library. David
[toc] | [prev] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2017-01-08 07:30 +0100 |
| Message-ID | <sXf9o-2IO-9@gated-at.bofh.it> |
| In reply to | #1552676 |
Hi. 2017-01-06 19:45 GMT+09:00 David Howells <dhowells@redhat.com>: > Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > >> 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 > > You need to be very careful doing this. Some userspace stuff depends on the > guard macro names on the kernel header files. Oh... >> /* 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)) > > How likely is this to collide with existing userspace code somewhere? It > looks like the sort of thing that could collide with a C library. Sorry, I do not have enough insight to answer your questions. Andrew, If this seems dangerous, please feel free to drop the entire series because it is not adding any value except some cleanups. -- Best Regards Masahiro Yamada
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web