16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28a1ab315SDavid Howells #ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG 38a1ab315SDavid Howells #define _UAPI__ASM_GENERIC_BITS_PER_LONG 48a1ab315SDavid Howells 5*8386f58fSTiezhu Yang #ifndef __BITS_PER_LONG 6*8386f58fSTiezhu Yang /* 7*8386f58fSTiezhu Yang * In order to keep safe and avoid regression, only unify uapi 8*8386f58fSTiezhu Yang * bitsperlong.h for some archs which are using newer toolchains 9*8386f58fSTiezhu Yang * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__. 10*8386f58fSTiezhu Yang * See the following link for more info: 11*8386f58fSTiezhu Yang * https://lore.kernel.org/linux-arch/b9624545-2c80-49a1-ac3c-39264a591f7b@app.fastmail.com/ 12*8386f58fSTiezhu Yang */ 13*8386f58fSTiezhu Yang #if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__) 14*8386f58fSTiezhu Yang #define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__) 15*8386f58fSTiezhu Yang #else 168a1ab315SDavid Howells /* 178a1ab315SDavid Howells * There seems to be no way of detecting this automatically from user 188a1ab315SDavid Howells * space, so 64 bit architectures should override this in their 198a1ab315SDavid Howells * bitsperlong.h. In particular, an architecture that supports 208a1ab315SDavid Howells * both 32 and 64 bit user space must not rely on CONFIG_64BIT 218a1ab315SDavid Howells * to decide it, but rather check a compiler provided macro. 228a1ab315SDavid Howells */ 238a1ab315SDavid Howells #define __BITS_PER_LONG 32 248a1ab315SDavid Howells #endif 25*8386f58fSTiezhu Yang #endif 268a1ab315SDavid Howells 278a1ab315SDavid Howells #endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */ 28