X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=include%2Fasm-avr32%2Funaligned.h;h=041877290470f18b3867234e9ff3459d97df8d28;hb=252815b0cfe711001eff0327872209986b36d490;hp=3042723fcbfd69b267ba8e8216be5d7090cb771c;hpb=b278240839e20fa9384ea430df463b367b90e04e;p=linux-2.6 diff --git a/include/asm-avr32/unaligned.h b/include/asm-avr32/unaligned.h index 3042723fcb..0418772904 100644 --- a/include/asm-avr32/unaligned.h +++ b/include/asm-avr32/unaligned.h @@ -1,5 +1,5 @@ -#ifndef __ASM_AVR32_UNALIGNED_H -#define __ASM_AVR32_UNALIGNED_H +#ifndef _ASM_AVR32_UNALIGNED_H +#define _ASM_AVR32_UNALIGNED_H /* * AVR32 can handle some unaligned accesses, depending on the @@ -7,19 +7,15 @@ * words, but halfwords must be halfword-aligned, and doublewords must * be word-aligned. * - * TODO: Make all this CPU-specific and optimize. + * However, swapped word loads must be word-aligned so we can't + * optimize word loads in general. */ -#include +#include +#include +#include -/* Use memmove here, so gcc does not insert a __builtin_memcpy. */ +#define get_unaligned __get_unaligned_be +#define put_unaligned __put_unaligned_be -#define get_unaligned(ptr) \ - ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) - -#define put_unaligned(val, ptr) \ - ({ __typeof__(*(ptr)) __tmp = (val); \ - memmove((ptr), &__tmp, sizeof(*(ptr))); \ - (void)0; }) - -#endif /* __ASM_AVR32_UNALIGNED_H */ +#endif /* _ASM_AVR32_UNALIGNED_H */