public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.4] jffs2 aligment problems
@ 2004-06-07 15:08 Greg Weeks
  2004-06-07 15:36 ` Thomas Gleixner
  0 siblings, 1 reply; 11+ messages in thread
From: Greg Weeks @ 2004-06-07 15:08 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel

This fixed some jffs2 alignment problems we saw on an IXP425 based 
XScale board. I just got pinged that I was supposed to post this patch 
in case anyone else finds it usefull. This was against a modified 2.4.19 
kernel.

Greg Weeks

Signed-off-by: Greg Weeks <greg.weeks@timesys.com> under TS0067


--- kernel/drivers/mtd/chips/cfi_cmdset_0001.c-orig
+++ kernel/drivers/mtd/chips/cfi_cmdset_0001.c

@@ -933,7 +933,7 @@
        cfi_word status, status_OK;
        unsigned long cmd_adr, timeo;
        DECLARE_WAITQUEUE(wait, current);
-       int wbufsize, z, suspended=0, ret=0;
+       int wbufsize, z, y, suspended=0, ret=0;

        wbufsize = CFIDEV_INTERLEAVE << cfi->cfiq->MaxBufWriteSize;
        adr += chip->start;
@@ -1064,12 +1064,18 @@

        /* Write data */
        for (z = 0; z < len; z += CFIDEV_BUSWIDTH) {
+               cfi_word aligned_val;
+               u_char *align_ptr = (u_char *) &aligned_val;
+
+               for (y = 0; y < CFIDEV_BUSWIDTH; y++)
+                       align_ptr[y] = *(buf++);
+
                if (cfi_buswidth_is_1()) {
-                       map->write8 (map, *((__u8*)buf)++, adr+z);
+                       map->write8 (map, *((__u8 *) &aligned_val), adr+z);
                } else if (cfi_buswidth_is_2()) {
-                       map->write16 (map, *((__u16*)buf)++, adr+z);
+                       map->write16 (map, *((__u16 *) &aligned_val), 
adr+z);
                } else if (cfi_buswidth_is_4()) {
-                       map->write32 (map, *((__u32*)buf)++, adr+z);
+                       map->write32 (map, *((__u32 *) &aligned_val), 
adr+z);
                } else {
                        DISABLE_VPP(map);
                        ret = -EINVAL;


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-06-07 21:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-07 15:08 [PATCH 2.4] jffs2 aligment problems Greg Weeks
2004-06-07 15:36 ` Thomas Gleixner
2004-06-07 16:03   ` Linus Torvalds
2004-06-07 16:41     ` Russell King
2004-06-07 19:14       ` David Woodhouse
2004-06-07 19:22         ` Linus Torvalds
2004-06-07 20:39           ` David Woodhouse
2004-06-07 20:54             ` Linus Torvalds
2004-06-07 20:56               ` Thomas Gleixner
2004-06-07 21:29                 ` David Woodhouse
2004-06-07 21:40                   ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox