aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-02-17 15:35:04 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 06:39:55 -0400
commit332d71f7682d860b4439e197bc0ae85867458e1b (patch)
treefe0fbd8a7b25115833c18a6d0d1986c051e6badc /drivers/mtd/chips
parentb81226c5d55b16a23f044d37b45e9b6909d8fbce (diff)
[MTD] Make OTP actually work.
The OTP code is rather broken without this. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index b3f5acf0760c..f018ea162173 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (C) 2000 Red Hat. GPL'd 5 * (C) 2000 Red Hat. GPL'd
6 * 6 *
7 * $Id: cfi_cmdset_0001.c,v 1.167 2005/02/08 17:11:15 nico Exp $ 7 * $Id: cfi_cmdset_0001.c,v 1.168 2005/02/17 20:34:59 nico Exp $
8 * 8 *
9 * 9 *
10 * 10/10/2000 Nicolas Pitre <nico@cam.org> 10 * 10/10/2000 Nicolas Pitre <nico@cam.org>
@@ -2025,7 +2025,7 @@ do_otp_lock(struct map_info *map, struct flchip *chip, u_long offset,
2025 map_word datum; 2025 map_word datum;
2026 2026
2027 /* make sure area matches group boundaries */ 2027 /* make sure area matches group boundaries */
2028 if (offset != 0 || size != grpsz) 2028 if (size != grpsz)
2029 return -EXDEV; 2029 return -EXDEV;
2030 2030
2031 datum = map_word_ff(map); 2031 datum = map_word_ff(map);
@@ -2089,7 +2089,7 @@ static int cfi_intelext_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
2089 groupno = 0; 2089 groupno = 0;
2090 } 2090 }
2091 2091
2092 while (groups > 0) { 2092 while (len > 0 && groups > 0) {
2093 if (!action) { 2093 if (!action) {
2094 /* 2094 /*
2095 * Special case: if action is NULL 2095 * Special case: if action is NULL
@@ -2118,6 +2118,7 @@ static int cfi_intelext_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
2118 *retlen += sizeof(*otpinfo); 2118 *retlen += sizeof(*otpinfo);
2119 } else if (from >= groupsize) { 2119 } else if (from >= groupsize) {
2120 from -= groupsize; 2120 from -= groupsize;
2121 data_offset += groupsize;
2121 } else { 2122 } else {
2122 int size = groupsize; 2123 int size = groupsize;
2123 data_offset += from; 2124 data_offset += from;
@@ -2133,6 +2134,7 @@ static int cfi_intelext_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
2133 buf += size; 2134 buf += size;
2134 len -= size; 2135 len -= size;
2135 *retlen += size; 2136 *retlen += size;
2137 data_offset += size;
2136 } 2138 }
2137 groupno++; 2139 groupno++;
2138 groups--; 2140 groups--;