提交 707ced0d 编写于 作者: A Atsushi Nemoto 提交者: Linus Torvalds

[PATCH] __get_unaligned() gcc-4 fix

If the 'ptr' is a const, this code cause "assignment of read-only variable"
error on gcc 4.x.

Use __u64 instead of __typeof__(*(ptr)) for temporary variable to get
rid of errors on gcc 4.x.
Signed-off-by: NAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 81c29a85
......@@ -78,7 +78,7 @@ static inline void __ustw(__u16 val, __u16 *addr)
#define __get_unaligned(ptr, size) ({ \
const void *__gu_p = ptr; \
__typeof__(*(ptr)) val; \
__u64 val; \
switch (size) { \
case 1: \
val = *(const __u8 *)__gu_p; \
......@@ -95,7 +95,7 @@ static inline void __ustw(__u16 val, __u16 *addr)
default: \
bad_unaligned_access_length(); \
}; \
val; \
(__typeof__(*(ptr)))val; \
})
#define __put_unaligned(val, ptr, size) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册