Remove remaining __get_unaligned_cpu32
cover Remove remaining __get_unaligned_cpu32
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.
---
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
Signature · 1 line
2.34.1
PATCH RESEND 1/5 Replace __get_unaligned_cpu32 in jhash function
The __get_unaligned_cpu32 function is deprecated. So, replace it with the more generic get_unaligned and just cast the input parameter.
--- include/linux/jhash.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/jhash.h +4 -4
@@ -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 ;
Signature · 1 line
2.34.1
PATCH RESEND 2/5 Remove unaligned/packed_struct.h header
In reply to Julian VetterThe functions in this header are deprecated and are not used anymore. So, remove the header entirely.
--- 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
include/linux/unaligned.h +0 -1
@@ -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>
include/linux/unaligned/packed_struct.h deleted +0 -46
46 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH RESEND 3/5 tools: Replace __get_unaligned_cpu32 in jhash function
In reply to Julian VetterThe __get_unaligned_cpu32 function is deprecated. So, replace it with the more generic get_unaligned and just cast the input parameter.
--- tools/include/linux/jhash.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/include/linux/jhash.h +4 -4
@@ -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 ;
Signature · 1 line
2.34.1
PATCH RESEND 4/5 tools: Remove unaligned/packed_struct.h header
In reply to Julian VetterThe functions in this header are deprecated and are not used anymore. So, remove the header entirely.
--- tools/include/linux/unaligned/packed_struct.h | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 tools/include/linux/unaligned/packed_struct.h
tools/include/linux/unaligned/packed_struct.h deleted +0 -47
@@ -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 */
Signature · 1 line
2.34.1
PATCH RESEND 5/5 tools: Remove the check for packed_struct.h header
In reply to Julian VetterThe 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'.
--- tools/perf/check-headers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/check-headers.sh +1 -1
@@ -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$"'
Signature · 1 line
2.34.1