summaryrefslogtreecommitdiff
path: root/packages/linux/nslu2-kernel/2.6.15/mtd-unaligned-read-fix
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-11-14 06:29:32 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-11-14 06:29:32 +0000
commit15b6993ce68956022af5df22d110898f8b61a252 (patch)
treee9b379bbf85d4899847a615ddb67fa9f05451e13 /packages/linux/nslu2-kernel/2.6.15/mtd-unaligned-read-fix
parentb36999d27c8d713ae2421c130633a796f4e98f83 (diff)
nslu2-kernel: upgrade to 2.6.14.2
nslu2-kernel: add (only semi working) 2.6.15-rc1
Diffstat (limited to 'packages/linux/nslu2-kernel/2.6.15/mtd-unaligned-read-fix')
-rw-r--r--packages/linux/nslu2-kernel/2.6.15/mtd-unaligned-read-fix40
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/linux/nslu2-kernel/2.6.15/mtd-unaligned-read-fix b/packages/linux/nslu2-kernel/2.6.15/mtd-unaligned-read-fix
new file mode 100644
index 0000000000..f4f468ce85
--- /dev/null
+++ b/packages/linux/nslu2-kernel/2.6.15/mtd-unaligned-read-fix
@@ -0,0 +1,40 @@
+diff -u linux-2.6-working/drivers/mtd/maps/ixp4xx.c linux-2.6-working/drivers/mtd/maps/ixp4xx.c
+--- linux-2.6.15/drivers/mtd/maps/ixp4xx.c 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/drivers/mtd/maps/ixp4xx.c 1970-01-01 00:00:00.000000000 +0000
+@@ -53,19 +53,28 @@
+ static void ixp4xx_copy_from(struct map_info *map, void *to,
+ unsigned long from, ssize_t len)
+ {
+- int i;
+ u8 *dest = (u8 *) to;
+ void __iomem *src = map->virt + from;
+- u16 data;
+
+- for (i = 0; i < (len / 2); i++) {
+- data = le16_to_cpu(readw(src + 2*i));
+- dest[i * 2] = BYTE0(data);
+- dest[i * 2 + 1] = BYTE1(data);
++ if (len <= 0)
++ return;
++
++ if (from & 1) {
++ *dest++ = BYTE1(le16_to_cpu(readw(src)));
++ src++;
++ --len;
++ }
++
++ while (len >= 2) {
++ u16 data = le16_to_cpu(readw(src));
++ *dest++ = BYTE0(data);
++ *dest++ = BYTE1(data);
++ src += 2;
++ len -= 2;
+ }
+
+- if (len & 1)
+- dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i)));
++ if (len > 0)
++ *dest++ = BYTE0(le16_to_cpu(readw(src)));
+ }
+
+ /*