summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-09-23 08:39:59 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-09-23 08:39:59 +0000
commit1192d89e907eba5a279ed74e8d42b96bc12760e7 (patch)
tree3e42e4938de80ffb636391ae46b2a5cf837ba1b6
parenta7af11b6bd8f7ae04f3377cf84b8c79d0a42bf6d (diff)
nslu2-kernel: reworked ixp4xx copy_from patch
-rw-r--r--packages/linux/nslu2-kernel/2.6/10-ixp4xx-copy-from.patch50
1 files changed, 31 insertions, 19 deletions
diff --git a/packages/linux/nslu2-kernel/2.6/10-ixp4xx-copy-from.patch b/packages/linux/nslu2-kernel/2.6/10-ixp4xx-copy-from.patch
index 8d0f187d44..03d94d282c 100644
--- a/packages/linux/nslu2-kernel/2.6/10-ixp4xx-copy-from.patch
+++ b/packages/linux/nslu2-kernel/2.6/10-ixp4xx-copy-from.patch
@@ -1,27 +1,39 @@
---- linux-2.6.11/drivers/mtd/maps/ixp4xx.c.orig 2005-03-05 20:00:28.000000000 +0100
-+++ linux-2.6.11/drivers/mtd/maps/ixp4xx.c 2005-03-05 22:10:48.000000000 +0100
-@@ -29,6 +29,8 @@
- #include <asm/mach-types.h>
- #include <asm/mach/flash.h>
+# This patch fixes ixp4xx_copy_from for cases where the 'from'
+# pointer is odd - that would cause all the accesses to be
+# misaligned in the old code.
+--- linux-2.6.12.2/.pc/ixp4xx_copy_from.patch/drivers/mtd/maps/ixp4xx.c 2005-09-21 22:35:38.761014739 -0700
++++ linux-2.6.12.2/drivers/mtd/maps/ixp4xx.c 2005-09-23 01:27:54.696223365 -0700
+@@ -54,19 +54,23 @@
+ static void ixp4xx_copy_from(struct map_info *map, void *to,
+ unsigned long from, ssize_t len)
+ {
+- int i;
+- u8 *dest = (u8 *) to;
+- u16 *src = (u16 *) (map->map_priv_1 + from);
+- u16 data;
++ if (len <= 0)
++ return;
-+#include <asm/unaligned.h>
-+
- #include <linux/reboot.h>
-
- #ifndef __ARMEB__
-@@ -60,13 +62,13 @@ static void ixp4xx_copy_from(struct map_
- u16 data;
-
- for (i = 0; i < (len / 2); i++) {
+- for (i = 0; i < (len / 2); i++) {
- data = src[i];
-+ data = get_unaligned((u16*)(src + i));
- dest[i * 2] = BYTE0(data);
- dest[i * 2 + 1] = BYTE1(data);
+- dest[i * 2] = BYTE0(data);
+- dest[i * 2 + 1] = BYTE1(data);
++ u8 *dest = (u8 *) to;
++ u8 *src = (u8 *) (map->map_priv_1 + from);
++ if (from & 1)
++ *dest++ = BYTE1(*(u16 *)(src-1)), ++src, --len;
++
++ while (len >= 2) {
++ u16 data = *(u16 *)src; src += 2;
++ *dest++ = BYTE0(data);
++ *dest++ = BYTE1(data);
++ len -= 2;
}
- if (len & 1)
+- if (len & 1)
- dest[len - 1] = BYTE0(src[i]);
-+ dest[len - 1] = BYTE0(get_unaligned((u16*)(src + i)));
++ if (len > 0)
++ *dest++ = BYTE0(*(u16 *)src);
}
/*