All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Weeks <greg.weeks@timesys.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2.4] jffs2 aligment problems
Date: Mon, 07 Jun 2004 11:08:41 -0400	[thread overview]
Message-ID: <40C484F9.20504@timesys.com> (raw)

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;


             reply	other threads:[~2004-06-07 15:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-07 15:08 Greg Weeks [this message]
2004-06-07 15:36 ` [PATCH 2.4] jffs2 aligment problems 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40C484F9.20504@timesys.com \
    --to=greg.weeks@timesys.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.