]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-avr32/unaligned.h
isicom: use tty_port
[linux-2.6-omap-h63xx.git] / include / asm-avr32 / unaligned.h
index 3042723fcbfd69b267ba8e8216be5d7090cb771c..041877290470f18b3867234e9ff3459d97df8d28 100644 (file)
@@ -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 <linux/string.h>
+#include <linux/unaligned/be_struct.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
 
-/* 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 */