linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 0/5] Remove remaining __get_unaligned_cpu32
@ 2025-07-07 12:24 Julian Vetter
  2025-07-07 12:24 ` [PATCH RESEND 1/5] Replace __get_unaligned_cpu32 in jhash function Julian Vetter
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Julian Vetter @ 2025-07-07 12:24 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Liang, Kan, Jason A. Donenfeld,
	Christophe Leroy, Al Viro
  Cc: linux-perf-users, linux-kernel, Julian Vetter

I have send these patches already as individual patches, but this was
wrong, and confused people because they have a dependency between them.
So, I resend them as a patchset, which removes all remaining apperances of
__get_unaligned_cpu32.

Signed-off-by: Julian Vetter <julian@outer-limits.org>
---
Julian Vetter (5):
  Replace __get_unaligned_cpu32 in jhash function
  Remove unaligned/packed_struct.h header
  tools: Replace __get_unaligned_cpu32 in jhash function
  tools: Remove unaligned/packed_struct.h header
  tools: Remove the check for packed_struct.h header

 include/linux/jhash.h                         |  8 ++--
 include/linux/unaligned.h                     |  1 -
 include/linux/unaligned/packed_struct.h       | 46 ------------------
 tools/include/linux/jhash.h                   |  8 ++--
 tools/include/linux/unaligned/packed_struct.h | 47 -------------------
 tools/perf/check-headers.sh                   |  2 +-
 6 files changed, 9 insertions(+), 103 deletions(-)
 delete mode 100644 include/linux/unaligned/packed_struct.h
 delete mode 100644 tools/include/linux/unaligned/packed_struct.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH RESEND 1/5] Replace __get_unaligned_cpu32 in jhash function
  2025-07-07 12:24 [PATCH RESEND 0/5] Remove remaining __get_unaligned_cpu32 Julian Vetter
@ 2025-07-07 12:24 ` Julian Vetter
  2025-07-07 12:24 ` [PATCH RESEND 2/5] Remove unaligned/packed_struct.h header Julian Vetter
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Vetter @ 2025-07-07 12:24 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Liang, Kan, Jason A. Donenfeld,
	Christophe Leroy, Al Viro
  Cc: linux-perf-users, linux-kernel, Julian Vetter

The __get_unaligned_cpu32 function is deprecated. So, replace it with
the more generic get_unaligned and just cast the input parameter.

Signed-off-by: Julian Vetter <julian@outer-limits.org>
---
 include/linux/jhash.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index fa26a2dd3b52..7c1c1821c694 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -24,7 +24,7 @@
  * Jozsef
  */
 #include <linux/bitops.h>
-#include <linux/unaligned/packed_struct.h>
+#include <linux/unaligned.h>
 
 /* Best hash sizes are of power of two */
 #define jhash_size(n)   ((u32)1<<(n))
@@ -77,9 +77,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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND 2/5] Remove unaligned/packed_struct.h header
  2025-07-07 12:24 [PATCH RESEND 0/5] Remove remaining __get_unaligned_cpu32 Julian Vetter
  2025-07-07 12:24 ` [PATCH RESEND 1/5] Replace __get_unaligned_cpu32 in jhash function Julian Vetter
@ 2025-07-07 12:24 ` Julian Vetter
  2025-07-07 12:24 ` [PATCH RESEND 3/5] tools: Replace __get_unaligned_cpu32 in jhash function Julian Vetter
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Vetter @ 2025-07-07 12:24 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Liang, Kan, Jason A. Donenfeld,
	Christophe Leroy, Al Viro
  Cc: linux-perf-users, linux-kernel, Julian Vetter

The functions in this header are deprecated and are not used anymore.
So, remove the header entirely.

Signed-off-by: Julian Vetter <julian@outer-limits.org>
---
 include/linux/unaligned.h               |  1 -
 include/linux/unaligned/packed_struct.h | 46 -------------------------
 2 files changed, 47 deletions(-)
 delete mode 100644 include/linux/unaligned/packed_struct.h

diff --git a/include/linux/unaligned.h b/include/linux/unaligned.h
index 4a9651017e3c..18c4b0c00e2a 100644
--- a/include/linux/unaligned.h
+++ b/include/linux/unaligned.h
@@ -6,7 +6,6 @@
  * This is the most generic implementation of unaligned accesses
  * and should work almost anywhere.
  */
-#include <linux/unaligned/packed_struct.h>
 #include <asm/byteorder.h>
 #include <vdso/unaligned.h>
 
diff --git a/include/linux/unaligned/packed_struct.h b/include/linux/unaligned/packed_struct.h
deleted file mode 100644
index f4c8eaf4d012..000000000000
--- a/include/linux/unaligned/packed_struct.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H
-#define _LINUX_UNALIGNED_PACKED_STRUCT_H
-
-#include <linux/types.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 */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND 3/5] tools: Replace __get_unaligned_cpu32 in jhash function
  2025-07-07 12:24 [PATCH RESEND 0/5] Remove remaining __get_unaligned_cpu32 Julian Vetter
  2025-07-07 12:24 ` [PATCH RESEND 1/5] Replace __get_unaligned_cpu32 in jhash function Julian Vetter
  2025-07-07 12:24 ` [PATCH RESEND 2/5] Remove unaligned/packed_struct.h header Julian Vetter
@ 2025-07-07 12:24 ` Julian Vetter
  2025-07-07 12:24 ` [PATCH RESEND 4/5] tools: Remove unaligned/packed_struct.h header Julian Vetter
  2025-07-07 12:25 ` [PATCH RESEND 5/5] tools: Remove the check for packed_struct.h header Julian Vetter
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Vetter @ 2025-07-07 12:24 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Liang, Kan, Jason A. Donenfeld,
	Christophe Leroy, Al Viro
  Cc: linux-perf-users, linux-kernel, Julian Vetter

The __get_unaligned_cpu32 function is deprecated. So, replace it with
the more generic get_unaligned and just cast the input parameter.

Signed-off-by: Julian Vetter <julian@outer-limits.org>
---
 tools/include/linux/jhash.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/include/linux/jhash.h b/tools/include/linux/jhash.h
index af8d0fe1c6ce..5ff3c8275281 100644
--- a/tools/include/linux/jhash.h
+++ b/tools/include/linux/jhash.h
@@ -24,7 +24,7 @@
  * Jozsef
  */
 #include <linux/bitops.h>
-#include <linux/unaligned/packed_struct.h>
+#include <linux/unaligned.h>
 
 /* Best hash sizes are of power of two */
 #define jhash_size(n)   ((u32)1<<(n))
@@ -77,9 +77,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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND 4/5] tools: Remove unaligned/packed_struct.h header
  2025-07-07 12:24 [PATCH RESEND 0/5] Remove remaining __get_unaligned_cpu32 Julian Vetter
                   ` (2 preceding siblings ...)
  2025-07-07 12:24 ` [PATCH RESEND 3/5] tools: Replace __get_unaligned_cpu32 in jhash function Julian Vetter
@ 2025-07-07 12:24 ` Julian Vetter
  2025-07-07 12:25 ` [PATCH RESEND 5/5] tools: Remove the check for packed_struct.h header Julian Vetter
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Vetter @ 2025-07-07 12:24 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Liang, Kan, Jason A. Donenfeld,
	Christophe Leroy, Al Viro
  Cc: linux-perf-users, linux-kernel, Julian Vetter

The functions in this header are deprecated and are not used anymore.
So, remove the header entirely.

Signed-off-by: Julian Vetter <julian@outer-limits.org>
---
 tools/include/linux/unaligned/packed_struct.h | 47 -------------------
 1 file changed, 47 deletions(-)
 delete mode 100644 tools/include/linux/unaligned/packed_struct.h

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 */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND 5/5] tools: Remove the check for packed_struct.h header
  2025-07-07 12:24 [PATCH RESEND 0/5] Remove remaining __get_unaligned_cpu32 Julian Vetter
                   ` (3 preceding siblings ...)
  2025-07-07 12:24 ` [PATCH RESEND 4/5] tools: Remove unaligned/packed_struct.h header Julian Vetter
@ 2025-07-07 12:25 ` Julian Vetter
  4 siblings, 0 replies; 6+ messages in thread
From: Julian Vetter @ 2025-07-07 12:25 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Liang, Kan, Jason A. Donenfeld,
	Christophe Leroy, Al Viro
  Cc: linux-perf-users, linux-kernel, Julian Vetter

The functions in the header 'unaligned/packed_struct.h' were deprecated,
and not used anymore, thus the header was removed. So, we can also
remove the check in 'check-headers.sh'.

Signed-off-by: Julian Vetter <julian@outer-limits.org>
---
 tools/perf/check-headers.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 8085e4d1d8af..637eec11ddfa 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -188,7 +188,7 @@ check arch/x86/lib/memcpy_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex
 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 arch/arm64/include/asm/cputype.h '-I "^#include [<\"]\(asm/\)*sysreg.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>" -I "^#pragma GCC diagnostic"'
 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.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-07 12:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07 12:24 [PATCH RESEND 0/5] Remove remaining __get_unaligned_cpu32 Julian Vetter
2025-07-07 12:24 ` [PATCH RESEND 1/5] Replace __get_unaligned_cpu32 in jhash function Julian Vetter
2025-07-07 12:24 ` [PATCH RESEND 2/5] Remove unaligned/packed_struct.h header Julian Vetter
2025-07-07 12:24 ` [PATCH RESEND 3/5] tools: Replace __get_unaligned_cpu32 in jhash function Julian Vetter
2025-07-07 12:24 ` [PATCH RESEND 4/5] tools: Remove unaligned/packed_struct.h header Julian Vetter
2025-07-07 12:25 ` [PATCH RESEND 5/5] tools: Remove the check for packed_struct.h header Julian Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).