umber-kernel/tools
Leo Yan dfcbe01951 tools: Fix bitfield dependency failure
[ Upstream commit a537c0da168a08b0b6a7f7bd9e75f4cc8d45ff57 ]

A perf build failure was reported by Thomas Voegtle on stable kernel
v6.6.120:

    CC      tests/sample-parsing.o
    CC      util/intel-pt-decoder/intel-pt-pkt-decoder.o
    CC      util/perf-regs-arch/perf_regs_csky.o
    CC      util/arm-spe-decoder/arm-spe-pkt-decoder.o
    CC      util/perf-regs-arch/perf_regs_loongarch.o
  In file included from util/arm-spe-decoder/arm-spe-pkt-decoder.h:10,
                   from util/arm-spe-decoder/arm-spe-pkt-decoder.c:14:
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h: In function ‘le16_encode_bits’:
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h:166:31: error: implicit declaration of
  function ‘cpu_to_le16’; did you mean ‘htole16’? [-Werror=implicit-function-declaration]
    ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
                                 ^~~~~~~~~
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h:149:9: note: in definition of macro
  ‘____MAKE_OP’
    return to((v & field_mask(field)) * field_multiplier(field)); \
           ^~
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h:170:1: note: in expansion of macro
  ‘__MAKE_OP’
   __MAKE_OP(16)

Fix this by including linux/kernel.h, which provides the required
definitions.

The issue was not found on the mainline due to the relevant C files have
included kernel.h.  It'd be good to merge this change on mainline
as well for robustness.

Closes: https://lore.kernel.org/stable/3a44500b-d7c8-179f-61f6-e51cb50d3512@lio96.de/
Fixes: 64d86c03e1 ("perf arm-spe: Extend branch operations")
Reported-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Reported-by: Thomas Voegtle <tv@lio96.de>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
To: Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-03-04 07:21:19 -05:00
..
accounting
arch tools headers: Go back to include asm-generic/unistd.h for arm64 2026-03-04 07:19:26 -05:00
bootconfig
bpf bpftool: Fix dependencies for static build 2026-03-04 07:19:42 -05:00
build
certs
cgroup
counter
crypto
debugging
docs
firewire
firmware
gpio
hv
iio
include tools: Fix bitfield dependency failure 2026-03-04 07:21:19 -05:00
kvm/kvm_stat
laptop
leds
lib libperf build: Always place libperf includes first 2026-03-04 07:19:27 -05:00
memory-model
mm tools/mm/page_owner_sort: fix timestamp comparison for stable sorting 2026-01-08 10:17:11 +01:00
net xdrgen: Remove inclusion of nlm4.h header 2026-02-26 14:59:18 -08:00
objtool kbuild: Add objtool to top-level clean target 2026-02-26 14:59:36 -08:00
pcmcia
perf perf test: Fix test case perftool-testsuite_report for s390 2026-03-04 07:19:27 -05:00
power tools/power cpupower: Reset errno before strtoull() 2026-03-04 07:19:33 -05:00
rcu
sched
sched_ext tools/sched_ext: fix scx_show_state.py for scx_root change 2026-01-08 10:16:48 +01:00
scripts
sound
spi spi: tools: Add include folder to .gitignore 2026-02-26 14:59:15 -08:00
testing selftests/mm/charge_reserved_hugetlb: drop mount size for hugetlbfs 2026-03-04 07:21:10 -05:00
thermal
time
tracing rtla: Fix NULL pointer dereference in actions_parse 2026-03-04 07:20:13 -05:00
usb
verification
virtio
wmi
workqueue
writeback
Makefile