Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

alpha: regularize the situation with asm/param.h

The only reason why alpha can't do what sparc et.al. are doing
is that include/asm-generic/param.h relies upon the value of HZ
set for userland header in uapi/asm/param.h being 100.

We need that value to define USER_HZ and we need that definition
to outlive the redefinition of HZ kernel-side. And alpha needs
it to be 1024, not 100 like everybody else.

So let's add __USER_HZ to uapi/asm-generic/param.h, defaulting to
100 and used to define HZ. That way include/asm-generic/param.h
can use that thing instead of open-coding it - it won't be affected
by undefining and redefining HZ.

That done, alpha asm/param.h can be removed and uapi/asm/param.h
switched to defining __USER_HZ and EXEC_PAGESIZE and then including
<asm-generic/param.h> - asm/param.h will resolve to uapi/asm/param.h,
which pulls <asm-generic/param.h>, which will do the right thing
both in the kernel and userland contexts.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro f65bbf05 674e55ef

+8 -21
-12
arch/alpha/include/asm/param.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_ALPHA_PARAM_H 3 - #define _ASM_ALPHA_PARAM_H 4 - 5 - #include <uapi/asm/param.h> 6 - 7 - # undef HZ 8 - # define HZ CONFIG_HZ 9 - # define USER_HZ 1024 10 - # define CLOCKS_PER_SEC USER_HZ /* frequency at which times() counts */ 11 - 12 - #endif /* _ASM_ALPHA_PARAM_H */
+2 -7
arch/alpha/include/uapi/asm/param.h
··· 2 2 #ifndef _UAPI_ASM_ALPHA_PARAM_H 3 3 #define _UAPI_ASM_ALPHA_PARAM_H 4 4 5 - #define HZ 1024 6 - 5 + #define __USER_HZ 1024 7 6 #define EXEC_PAGESIZE 8192 8 7 9 - #ifndef NOGROUP 10 - #define NOGROUP (-1) 11 - #endif 12 - 13 - #define MAXHOSTNAMELEN 64 /* max length of hostname */ 8 + #include <asm-generic/param.h> 14 9 15 10 #endif /* _UAPI_ASM_ALPHA_PARAM_H */
+1 -1
include/asm-generic/param.h
··· 6 6 7 7 # undef HZ 8 8 # define HZ CONFIG_HZ /* Internal kernel timer frequency */ 9 - # define USER_HZ 100 /* some user interfaces are */ 9 + # define USER_HZ __USER_HZ /* some user interfaces are */ 10 10 # define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */ 11 11 #endif /* __ASM_GENERIC_PARAM_H */
+5 -1
include/uapi/asm-generic/param.h
··· 2 2 #ifndef _UAPI__ASM_GENERIC_PARAM_H 3 3 #define _UAPI__ASM_GENERIC_PARAM_H 4 4 5 + #ifndef __USER_HZ 6 + #define __USER_HZ 100 7 + #endif 8 + 5 9 #ifndef HZ 6 - #define HZ 100 10 + #define HZ __USER_HZ 7 11 #endif 8 12 9 13 #ifndef EXEC_PAGESIZE