Skip to contentSkip to conversation

Remove unaligned/packed_struct.h header

PATCH In review Julian Vetter 3 participants 4 messages Jun 3, 2025 – Jun 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove unaligned/packed_struct.h header

The 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
index 4a9651017e3c..18c4b0c00e2a 100644
@@ -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
#1 lore raw
Quoted 2 lines · Julian Vetter

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

; git grep -n __get_unaligned_cpu32

include/linux/jhash.h:80:               a += __get_unaligned_cpu32(k);
include/linux/jhash.h:81:               b += __get_unaligned_cpu32(k + 4);
include/linux/jhash.h:82:               c += __get_unaligned_cpu32(k + 8);
include/linux/unaligned/packed_struct.h:16:static inline u32 __get_unaligned_cpu32(const void *p)
tools/include/linux/jhash.h:80:         a += __get_unaligned_cpu32(k);
tools/include/linux/jhash.h:81:         b += __get_unaligned_cpu32(k + 4);
tools/include/linux/jhash.h:82:         c += __get_unaligned_cpu32(k + 8);

tools/include/linux/unaligned/packed_struct.h:17:static inline u32 __get_unaligned_cpu32(const void *p)

#2 lore raw
Quoted 4 lines · Al Viro
Quoted 2 lines · Julian Vetter

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

Yes, sorry. I messed it up. For now the patch can be ignored. I will re-send it once, all appearances of '__get_unaligned_cpu32' are removed. I have already send according patches for the 2 remaining files that still use it, namely 'include/linux/jhash.h' and 'tools/include/linux/jhash.h'.

Sorry again.

Quoted 9 lines

; git grep -n __get_unaligned_cpu32

include/linux/jhash.h:80:               a += __get_unaligned_cpu32(k);
include/linux/jhash.h:81:               b += __get_unaligned_cpu32(k + 4);
include/linux/jhash.h:82:               c += __get_unaligned_cpu32(k + 8);
include/linux/unaligned/packed_struct.h:16:static inline u32 __get_unaligned_cpu32(const void *p)
tools/include/linux/jhash.h:80:         a += __get_unaligned_cpu32(k);
tools/include/linux/jhash.h:81:         b += __get_unaligned_cpu32(k + 4);
tools/include/linux/jhash.h:82:         c += __get_unaligned_cpu32(k + 8);

tools/include/linux/unaligned/packed_struct.h:17:static inline u32 __get_unaligned_cpu32(const void *p)

#3 lore raw
In reply to Julian Vetter

Le 03/06/2025 à 15:24, Julian Vetter a écrit :

Quoted 2 lines

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

Your patch seems uncomplete.

$ git grep get_unaligned_cpu linus/master
linus/master:include/linux/jhash.h:             a += __get_unaligned_cpu32(k);
linus/master:include/linux/jhash.h:             b += __get_unaligned_cpu32(k + 4);
linus/master:include/linux/jhash.h:             c += __get_unaligned_cpu32(k + 8);
linus/master:include/linux/unaligned/packed_struct.h:static inline u16 __get_unaligned_cpu16(const void *p)
linus/master:include/linux/unaligned/packed_struct.h:static inline u32 __get_unaligned_cpu32(const void *p)
linus/master:include/linux/unaligned/packed_struct.h:static inline u64 __get_unaligned_cpu64(const void *p)
linus/master:tools/include/linux/jhash.h:               a += __get_unaligned_cpu32(k);
linus/master:tools/include/linux/jhash.h:               b += __get_unaligned_cpu32(k + 4);
linus/master:tools/include/linux/jhash.h:               c += __get_unaligned_cpu32(k + 8);
linus/master:tools/include/linux/unaligned/packed_struct.h:static inline u16 __get_unaligned_cpu16(const void *p)
linus/master:tools/include/linux/unaligned/packed_struct.h:static inline u32 __get_unaligned_cpu32(const void *p)
linus/master:tools/include/linux/unaligned/packed_struct.h:static inline u64 __get_unaligned_cpu64(const void *p)

Christophe

Quoted 72 lines
---
  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
index 4a9651017e3c..18c4b0c00e2a 100644
@@ -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
deleted file mode 100644
index f4c8eaf4d012..000000000000
@@ -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 */