From: Julian Vetter <julian@outer-limits.org>
To: Andrew Morton <akpm@linux-foundation.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Julian Vetter <julian@outer-limits.org>
Subject: [PATCH v2 2/2] tools/include/linux/jhash.h: replace __get_unaligned_cpu32 in jhash function
Date: Thu, 29 Oct 2026 10:17:36 +0100 [thread overview]
Message-ID: <20261029091736.28742-3-julian@outer-limits.org> (raw)
In-Reply-To: <20261029091736.28742-1-julian@outer-limits.org>
__get_unaligned_cpu32() is deprecated. So, replace it with the more
generic get_unaligned() and just cast the input parameter, like it was
done for the kernel copy of jhash.h.
linux/unaligned/packed_struct.h used to pull in linux/kernel.h, which
provides the byte order helpers needed by linux/unaligned.h, so include
it explicitly.
With jhash.h converted, the tools copy of packed_struct.h has no users
left, so remove it. Also drop the packed_struct.h and "#pragma GCC
diagnostic" in check-headers.sh.
Signed-off-by: Julian Vetter <julian@outer-limits.org>
---
tools/include/linux/jhash.h | 9 ++--
tools/include/linux/unaligned/packed_struct.h | 47 -------------------
| 2 +-
3 files changed, 6 insertions(+), 52 deletions(-)
delete mode 100644 tools/include/linux/unaligned/packed_struct.h
diff --git a/tools/include/linux/jhash.h b/tools/include/linux/jhash.h
index af8d0fe1c6ce..df524ee14bcd 100644
--- a/tools/include/linux/jhash.h
+++ b/tools/include/linux/jhash.h
@@ -24,7 +24,8 @@
* Jozsef
*/
#include <linux/bitops.h>
-#include <linux/unaligned/packed_struct.h>
+#include <linux/kernel.h>
+#include <linux/unaligned.h>
/* Best hash sizes are of power of two */
#define jhash_size(n) ((u32)1<<(n))
@@ -77,9 +78,9 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
/* All but the last block: affect some 32 bits of (a,b,c) */
while (length > 12) {
- a += __get_unaligned_cpu32(k);
- b += __get_unaligned_cpu32(k + 4);
- c += __get_unaligned_cpu32(k + 8);
+ a += get_unaligned((u32 *)k);
+ b += get_unaligned((u32 *)(k + 4));
+ c += get_unaligned((u32 *)(k + 8));
__jhash_mix(a, b, c);
length -= 12;
k += 12;
diff --git a/tools/include/linux/unaligned/packed_struct.h b/tools/include/linux/unaligned/packed_struct.h
deleted file mode 100644
index dbd93c7df2e1..000000000000
--- a/tools/include/linux/unaligned/packed_struct.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H
-#define _LINUX_UNALIGNED_PACKED_STRUCT_H
-
-#include <linux/kernel.h>
-
-struct __una_u16 { u16 x; } __packed;
-struct __una_u32 { u32 x; } __packed;
-struct __una_u64 { u64 x; } __packed;
-
-static inline u16 __get_unaligned_cpu16(const void *p)
-{
- const struct __una_u16 *ptr = (const struct __una_u16 *)p;
- return ptr->x;
-}
-
-static inline u32 __get_unaligned_cpu32(const void *p)
-{
- const struct __una_u32 *ptr = (const struct __una_u32 *)p;
- return ptr->x;
-}
-
-static inline u64 __get_unaligned_cpu64(const void *p)
-{
- const struct __una_u64 *ptr = (const struct __una_u64 *)p;
- return ptr->x;
-}
-
-static inline void __put_unaligned_cpu16(u16 val, void *p)
-{
- struct __una_u16 *ptr = (struct __una_u16 *)p;
- ptr->x = val;
-}
-
-static inline void __put_unaligned_cpu32(u32 val, void *p)
-{
- struct __una_u32 *ptr = (struct __una_u32 *)p;
- ptr->x = val;
-}
-
-static inline void __put_unaligned_cpu64(u64 val, void *p)
-{
- struct __una_u64 *ptr = (struct __una_u64 *)p;
- ptr->x = val;
-}
-
-#endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 531c0e0e84df..39d9c7182f9b 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -187,7 +187,7 @@ done
check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memcpy_\(erms\|orig\))" -I"^#include <linux/cfi_types.h>"'
check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"'
check arch/x86/include/asm/amd/ibs.h '-I "^#include .*/msr-index.h"'
-check include/linux/unaligned.h '-I "^#include <linux/unaligned/packed_struct.h>" -I "^#include <asm/byteorder.h>" -I "^#pragma GCC diagnostic"'
+check include/linux/unaligned.h '-I "^#include <asm/byteorder.h>"'
check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
--
2.53.0
next prev parent reply other threads:[~2026-10-29 9:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 9:17 [PATCH v2 0/2] Remove remaining __get_unaligned_cpu32 Julian Vetter
2026-10-29 9:17 ` [PATCH v2 1/2] include/linux/unaligned.h: remove deprecated __get_unaligned_cpuX() helpers Julian Vetter
2026-10-29 9:23 ` sashiko-bot
2026-10-29 11:11 ` David Laight
2026-10-29 9:17 ` Julian Vetter [this message]
2026-10-29 9:22 ` [PATCH v2 2/2] tools/include/linux/jhash.h: replace __get_unaligned_cpu32 in jhash function sashiko-bot
2026-10-29 12:43 ` [PATCH v2 0/2] Remove remaining __get_unaligned_cpu32 Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261029091736.28742-3-julian@outer-limits.org \
--to=julian@outer-limits.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=arnd@arndb.de \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox