Broken __get_unaligned from <asm-generic/unaligned.h>

From: Andreas Schwab
Date: Thu Nov 10 2005 - 09:41:57 EST


__get_unaligned can't cope with const-qualified types:

drivers/char/vc_screen.c: In function 'vcs_write':
drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'
drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'
drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'
drivers/char/vc_screen.c:422: error: assignment of read-only variable 'val'

Signed-off-by: Andreas Schwab <schwab@xxxxxxx>

--- linux-2.6.14/include/asm-generic/unaligned.h.~1~ 2005-10-28 02:02:08.000000000 +0200
+++ linux-2.6.14/include/asm-generic/unaligned.h 2005-11-10 14:37:58.356107194 +0100
@@ -78,7 +78,7 @@ static inline void __ustw(__u16 val, __u

#define __get_unaligned(ptr, size) ({ \
const void *__gu_p = ptr; \
- __typeof__(*(ptr)) val; \
+ unsigned long val; \
switch (size) { \
case 1: \
val = *(const __u8 *)__gu_p; \
@@ -95,7 +95,7 @@ static inline void __ustw(__u16 val, __u
default: \
bad_unaligned_access_length(); \
}; \
- val; \
+ (__typeof__(*(ptr)))val; \
})

#define __put_unaligned(val, ptr, size) \

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/