diff mbox

[2/6] mtd: chips: cfi_cmdset_0002: Match ENABLE_VPP()/DISABLE_VPP() calls

Message ID 1331129476.90478.YahooMailClassic@web29011.mail.ird.yahoo.com
State Accepted
Commit e7d9377e0440c25805dcc5b0af189a87beb69f5e
Headers show

Commit Message

Paul Parsons March 7, 2012, 2:11 p.m. UTC
This patch is part of a set which fixes unnecessary flash erase and write errors
resulting from the MTD CFI driver turning off vpp while an erase is in progress.
This patch ensures that only those flash operations which call ENABLE_VPP() can
then call DISABLE_VPP(). Other operations should never call DISABLE_VPP().

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
---
diff mbox

Patch

diff -uprN clean-3.3-rc6/drivers/mtd/chips/cfi_cmdset_0002.c linux-3.3-rc6/drivers/mtd/chips/cfi_cmdset_0002.c
--- clean-3.3-rc6/drivers/mtd/chips/cfi_cmdset_0002.c	2012-03-04 01:08:09.000000000 +0000
+++ linux-3.3-rc6/drivers/mtd/chips/cfi_cmdset_0002.c	2012-03-06 16:38:29.787134295 +0000
@@ -770,8 +770,6 @@  static void put_chip(struct map_info *ma
 
 	case FL_READY:
 	case FL_STATUS:
-		/* We should really make set_vpp() count, rather than doing this */
-		DISABLE_VPP(map);
 		break;
 	default:
 		printk(KERN_ERR "MTD: put_chip() called with oldstate %d!!\n", chip->oldstate);
@@ -1234,6 +1232,7 @@  static int __xipram do_write_oneword(str
 	xip_enable(map, chip, adr);
  op_done:
 	chip->state = FL_READY;
+	DISABLE_VPP(map);
 	put_chip(map, chip, adr);
 	mutex_unlock(&chip->mutex);
 
@@ -1476,6 +1475,7 @@  static int __xipram do_write_buffer(stru
 	ret = -EIO;
  op_done:
 	chip->state = FL_READY;
+	DISABLE_VPP(map);
 	put_chip(map, chip, adr);
 	mutex_unlock(&chip->mutex);
 
@@ -1649,6 +1649,7 @@  static int __xipram do_erase_chip(struct
 
 	chip->state = FL_READY;
 	xip_enable(map, chip, adr);
+	DISABLE_VPP(map);
 	put_chip(map, chip, adr);
 	mutex_unlock(&chip->mutex);
 
@@ -1739,6 +1740,7 @@  static int __xipram do_erase_oneblock(st
 	}
 
 	chip->state = FL_READY;
+	DISABLE_VPP(map);
 	put_chip(map, chip, adr);
 	mutex_unlock(&chip->mutex);
 	return ret;