Skip to content

Commit

Permalink
[MTD] NAND: Fix breakage all over the place
Browse files Browse the repository at this point in the history
Following problems are addressed:

- wrong status caused early break out of nand_wait()
- removed the bogus status check in nand_wait() which
  is a relict of the abandoned support for interrupted
  erase.
- status check moved to the correct place in read_oob
- oob support for syndrom based ecc with strange layouts
- use given offset in the AUTOOOB based oob operations

Partially based on a patch from Vitaly Vool <vwool@ru.mvista.com>
Thanks to Savin Zlobec <savin@epico.si> for tracking down the
status problem.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner authored and David Woodhouse committed Jun 20, 2006
1 parent 7e4178f commit 7bc3312
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 88 deletions.
8 changes: 4 additions & 4 deletions drivers/mtd/mtdchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
return ret;

ops.len = buf.length;
ops.ooblen = mtd->oobsize;
ops.ooblen = buf.length;
ops.ooboffs = buf.start & (mtd->oobsize - 1);
ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE;

if (ops.ooboffs && ops.len > (ops.ooblen - ops.ooboffs))
if (ops.ooboffs && ops.len > (mtd->oobsize - ops.ooboffs))
return -EINVAL;

ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);
Expand Down Expand Up @@ -553,12 +553,12 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
return ret;

ops.len = buf.length;
ops.ooblen = mtd->oobsize;
ops.ooblen = buf.length;
ops.ooboffs = buf.start & (mtd->oobsize - 1);
ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE;

if (ops.ooboffs && ops.len > (ops.ooblen - ops.ooboffs))
if (ops.ooboffs && ops.len > (mtd->oobsize - ops.ooboffs))
return -EINVAL;

ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/diskonchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static void __init doc2000_count_chips(struct mtd_info *mtd)
printk(KERN_DEBUG "Detected %d chips per floor.\n", i);
}

static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this)
{
struct doc_priv *doc = this->priv;

Expand Down
Loading

0 comments on commit 7bc3312

Please sign in to comment.