diff options
-rw-r--r-- | include/asm-generic/unaligned.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h index 09ec447fe2af..16a466e50681 100644 --- a/include/asm-generic/unaligned.h +++ b/include/asm-generic/unaligned.h | |||
@@ -18,7 +18,8 @@ | |||
18 | #define get_unaligned(ptr) \ | 18 | #define get_unaligned(ptr) \ |
19 | __get_unaligned((ptr), sizeof(*(ptr))) | 19 | __get_unaligned((ptr), sizeof(*(ptr))) |
20 | #define put_unaligned(x,ptr) \ | 20 | #define put_unaligned(x,ptr) \ |
21 | __put_unaligned((__u64)(x), (ptr), sizeof(*(ptr))) | 21 | ((void)sizeof(*(ptr)=(x)),\ |
22 | __put_unaligned((__force __u64)(x), (ptr), sizeof(*(ptr)))) | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * This function doesn't actually exist. The idea is that when | 25 | * This function doesn't actually exist. The idea is that when |
@@ -95,21 +96,21 @@ static inline void __ustw(__u16 val, __u16 *addr) | |||
95 | default: \ | 96 | default: \ |
96 | bad_unaligned_access_length(); \ | 97 | bad_unaligned_access_length(); \ |
97 | }; \ | 98 | }; \ |
98 | (__typeof__(*(ptr)))val; \ | 99 | (__force __typeof__(*(ptr)))val; \ |
99 | }) | 100 | }) |
100 | 101 | ||
101 | #define __put_unaligned(val, ptr, size) \ | 102 | #define __put_unaligned(val, ptr, size) \ |
102 | do { \ | 103 | ({ \ |
103 | void *__gu_p = ptr; \ | 104 | void *__gu_p = ptr; \ |
104 | switch (size) { \ | 105 | switch (size) { \ |
105 | case 1: \ | 106 | case 1: \ |
106 | *(__u8 *)__gu_p = val; \ | 107 | *(__u8 *)__gu_p = (__force __u8)val; \ |
107 | break; \ | 108 | break; \ |
108 | case 2: \ | 109 | case 2: \ |
109 | __ustw(val, __gu_p); \ | 110 | __ustw((__force __u16)val, __gu_p); \ |
110 | break; \ | 111 | break; \ |
111 | case 4: \ | 112 | case 4: \ |
112 | __ustl(val, __gu_p); \ | 113 | __ustl((__force __u32)val, __gu_p); \ |
113 | break; \ | 114 | break; \ |
114 | case 8: \ | 115 | case 8: \ |
115 | __ustq(val, __gu_p); \ | 116 | __ustq(val, __gu_p); \ |
@@ -117,6 +118,7 @@ do { \ | |||
117 | default: \ | 118 | default: \ |
118 | bad_unaligned_access_length(); \ | 119 | bad_unaligned_access_length(); \ |
119 | }; \ | 120 | }; \ |
120 | } while(0) | 121 | (void)0; \ |
122 | }) | ||
121 | 123 | ||
122 | #endif /* _ASM_GENERIC_UNALIGNED_H */ | 124 | #endif /* _ASM_GENERIC_UNALIGNED_H */ |