OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / include / linux / unaligned / packed_struct.h
blobc0d817de4df24ec105aea734c85b6513a40688f5
1 #ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H
2 #define _LINUX_UNALIGNED_PACKED_STRUCT_H
4 #include <linux/kernel.h>
6 struct __una_u16 { u16 x; } __packed;
7 struct __una_u32 { u32 x; } __packed;
8 struct __una_u64 { u64 x; } __packed;
10 static inline u16 __get_unaligned_cpu16(const void *p)
12 const struct __una_u16 *ptr = (const struct __una_u16 *)p;
13 return ptr->x;
16 static inline u32 __get_unaligned_cpu32(const void *p)
18 const struct __una_u32 *ptr = (const struct __una_u32 *)p;
19 return ptr->x;
22 static inline u64 __get_unaligned_cpu64(const void *p)
24 const struct __una_u64 *ptr = (const struct __una_u64 *)p;
25 return ptr->x;
28 static inline void __put_unaligned_cpu16(u16 val, void *p)
30 struct __una_u16 *ptr = (struct __una_u16 *)p;
31 ptr->x = val;
34 static inline void __put_unaligned_cpu32(u32 val, void *p)
36 struct __una_u32 *ptr = (struct __una_u32 *)p;
37 ptr->x = val;
40 static inline void __put_unaligned_cpu64(u64 val, void *p)
42 struct __una_u64 *ptr = (struct __una_u64 *)p;
43 ptr->x = val;
46 #endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */