Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / include / linux / unaligned / access_ok.h
blob99c1b4d20b0ff22012d4b59b53b3e9f9be6b4236
1 #ifndef _LINUX_UNALIGNED_ACCESS_OK_H
2 #define _LINUX_UNALIGNED_ACCESS_OK_H
4 #include <linux/kernel.h>
5 #include <asm/byteorder.h>
7 static inline u16 get_unaligned_le16(const void *p)
9 return le16_to_cpup((__le16 *)p);
12 static inline u32 get_unaligned_le32(const void *p)
14 return le32_to_cpup((__le32 *)p);
17 static inline u64 get_unaligned_le64(const void *p)
19 return le64_to_cpup((__le64 *)p);
22 static inline u16 get_unaligned_be16(const void *p)
24 return be16_to_cpup((__be16 *)p);
27 static inline u32 get_unaligned_be32(const void *p)
29 return be32_to_cpup((__be32 *)p);
32 static inline u64 get_unaligned_be64(const void *p)
34 return be64_to_cpup((__be64 *)p);
37 static inline void put_unaligned_le16(u16 val, void *p)
39 *((__le16 *)p) = cpu_to_le16(val);
42 static inline void put_unaligned_le32(u32 val, void *p)
44 *((__le32 *)p) = cpu_to_le32(val);
47 static inline void put_unaligned_le64(u64 val, void *p)
49 *((__le64 *)p) = cpu_to_le64(val);
52 static inline void put_unaligned_be16(u16 val, void *p)
54 *((__be16 *)p) = cpu_to_be16(val);
57 static inline void put_unaligned_be32(u32 val, void *p)
59 *((__be32 *)p) = cpu_to_be32(val);
62 static inline void put_unaligned_be64(u64 val, void *p)
64 *((__be64 *)p) = cpu_to_be64(val);
67 #endif /* _LINUX_UNALIGNED_ACCESS_OK_H */