tools/headers: Synchronize kernel ABI headers
After the SPDX license tags were added a number of tooling headers got out of
sync with their kernel variants, generating lots of build warnings.
Sync them:
- tools/arch/x86/include/asm/disabled-features.h,
tools/arch/x86/include/asm/required-features.h,
tools/include/linux/hash.h:
Remove the SPDX tag where the kernel version does not have it.
- tools/include/asm-generic/bitops/__fls.h,
tools/include/asm-generic/bitops/arch_hweight.h,
tools/include/asm-generic/bitops/const_hweight.h,
tools/include/asm-generic/bitops/fls.h,
tools/include/asm-generic/bitops/fls64.h,
tools/include/uapi/asm-generic/ioctls.h,
tools/include/uapi/asm-generic/mman-common.h,
tools/include/uapi/sound/asound.h,
tools/include/uapi/linux/kvm.h,
tools/include/uapi/linux/perf_event.h,
tools/include/uapi/linux/sched.h,
tools/include/uapi/linux/vhost.h,
tools/include/uapi/sound/asound.h:
Add the SPDX tag of the respective kernel header.
- tools/include/uapi/linux/bpf_common.h,
tools/include/uapi/linux/fcntl.h,
tools/include/uapi/linux/hw_breakpoint.h,
tools/include/uapi/linux/mman.h,
tools/include/uapi/linux/stat.h,
Change the tag to the kernel header version:
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
Also sync other header details:
- include/uapi/sound/asound.h:
Fix pointless end of line whitespace noise the header grew in this cycle.
- tools/arch/x86/lib/memcpy_64.S:
Sync the code and add tools/include/asm/export.h with dummy wrappers
to support building the kernel side code in a tooling header environment.
- tools/include/uapi/asm-generic/mman.h,
tools/include/uapi/linux/bpf.h:
Sync other details that don't impact tooling's use of the ABIs.
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-11-03 12:18:37 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2016-07-18 18:13:22 -03:00
|
|
|
#ifndef _ASM_GENERIC_BITOPS___FLS_H_
|
|
|
|
#define _ASM_GENERIC_BITOPS___FLS_H_
|
|
|
|
|
|
|
|
#include <asm/types.h>
|
|
|
|
|
|
|
|
/**
|
2024-04-08 11:55:19 -07:00
|
|
|
* generic___fls - find last (most-significant) set bit in a long word
|
2016-07-18 18:13:22 -03:00
|
|
|
* @word: the word to search
|
|
|
|
*
|
|
|
|
* Undefined if no set bit exists, so code should check against 0 first.
|
|
|
|
*/
|
bitops: Change function return types from long to int
Change the return types of bitops functions (ffs, fls, and fns) from
long to int. The expected return values are in the range [0, 64], for
which int is sufficient.
Additionally, int aligns well with the return types of the corresponding
__builtin_* functions, potentially reducing overall type conversions.
Many of the existing bitops functions already return an int and don't
need to be changed. The bitops functions in arch/ should be considered
separately.
Adjust some return variables to match the function return types.
With GCC 13 and defconfig, these changes reduced the size of a test
kernel image by 5,432 bytes on arm64 and by 248 bytes on riscv; there
were no changes in size on x86_64, powerpc, or m68k.
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-04-21 00:38:37 +02:00
|
|
|
static __always_inline unsigned int generic___fls(unsigned long word)
|
2016-07-18 18:13:22 -03:00
|
|
|
{
|
bitops: Change function return types from long to int
Change the return types of bitops functions (ffs, fls, and fns) from
long to int. The expected return values are in the range [0, 64], for
which int is sufficient.
Additionally, int aligns well with the return types of the corresponding
__builtin_* functions, potentially reducing overall type conversions.
Many of the existing bitops functions already return an int and don't
need to be changed. The bitops functions in arch/ should be considered
separately.
Adjust some return variables to match the function return types.
With GCC 13 and defconfig, these changes reduced the size of a test
kernel image by 5,432 bytes on arm64 and by 248 bytes on riscv; there
were no changes in size on x86_64, powerpc, or m68k.
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-04-21 00:38:37 +02:00
|
|
|
unsigned int num = BITS_PER_LONG - 1;
|
2016-07-18 18:13:22 -03:00
|
|
|
|
|
|
|
#if BITS_PER_LONG == 64
|
|
|
|
if (!(word & (~0ul << 32))) {
|
|
|
|
num -= 32;
|
|
|
|
word <<= 32;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (!(word & (~0ul << (BITS_PER_LONG-16)))) {
|
|
|
|
num -= 16;
|
|
|
|
word <<= 16;
|
|
|
|
}
|
|
|
|
if (!(word & (~0ul << (BITS_PER_LONG-8)))) {
|
|
|
|
num -= 8;
|
|
|
|
word <<= 8;
|
|
|
|
}
|
|
|
|
if (!(word & (~0ul << (BITS_PER_LONG-4)))) {
|
|
|
|
num -= 4;
|
|
|
|
word <<= 4;
|
|
|
|
}
|
|
|
|
if (!(word & (~0ul << (BITS_PER_LONG-2)))) {
|
|
|
|
num -= 2;
|
|
|
|
word <<= 2;
|
|
|
|
}
|
|
|
|
if (!(word & (~0ul << (BITS_PER_LONG-1))))
|
|
|
|
num -= 1;
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
2024-04-08 11:55:19 -07:00
|
|
|
#ifndef __HAVE_ARCH___FLS
|
|
|
|
#define __fls(word) generic___fls(word)
|
|
|
|
#endif
|
|
|
|
|
2016-07-18 18:13:22 -03:00
|
|
|
#endif /* _ASM_GENERIC_BITOPS___FLS_H_ */
|