summaryrefslogtreecommitdiff
path: root/packages/linux/nslu2-kernel/2.6.13/10-ixp4xx-copy-from.patch
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-09-24 23:40:41 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-09-24 23:40:41 +0000
commit52fc464946f780b1302fe9ac47176415faf5ef9a (patch)
tree8ab0bf85e935c741ab1e90dcd9cd96a660562c26 /packages/linux/nslu2-kernel/2.6.13/10-ixp4xx-copy-from.patch
parent6fdac80bba1c2ccc0e675e2428f830a127fb3fb5 (diff)
nslu2-kernel, openslug-kernel: 2.6.14-rc2 (ixp425-eth will not build with this)
Diffstat (limited to 'packages/linux/nslu2-kernel/2.6.13/10-ixp4xx-copy-from.patch')
-rw-r--r--packages/linux/nslu2-kernel/2.6.13/10-ixp4xx-copy-from.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/packages/linux/nslu2-kernel/2.6.13/10-ixp4xx-copy-from.patch b/packages/linux/nslu2-kernel/2.6.13/10-ixp4xx-copy-from.patch
new file mode 100644
index 0000000000..03d94d282c
--- /dev/null
+++ b/packages/linux/nslu2-kernel/2.6.13/10-ixp4xx-copy-from.patch
@@ -0,0 +1,39 @@
+# 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;
+
+- for (i = 0; i < (len / 2); i++) {
+- data = src[i];
+- 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)
+- dest[len - 1] = BYTE0(src[i]);
++ if (len > 0)
++ *dest++ = BYTE0(*(u16 *)src);
+ }
+
+ /*