diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-23 10:30:16 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:25:19 -0500 |
commit | 329ad399a9b3adf52c90637b21ca029fcf7f8795 (patch) | |
tree | 7aa7bb2609c25de7859c3a666f3ea90934609592 /drivers/mtd/tests | |
parent | 04c601bfa4cb29c968dcb66e44c799c9c01d8675 (diff) |
mtd: introduce mtd_read interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/tests')
-rw-r--r-- | drivers/mtd/tests/mtd_pagetest.c | 28 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_readtest.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_speedtest.c | 8 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_stresstest.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_subpagetest.c | 8 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_torturetest.c | 2 |
6 files changed, 25 insertions, 25 deletions
diff --git a/drivers/mtd/tests/mtd_pagetest.c b/drivers/mtd/tests/mtd_pagetest.c index 271819fabb55..6d62e24a03ed 100644 --- a/drivers/mtd/tests/mtd_pagetest.c +++ b/drivers/mtd/tests/mtd_pagetest.c | |||
@@ -127,7 +127,7 @@ static int verify_eraseblock(int ebnum) | |||
127 | set_random_data(writebuf, mtd->erasesize); | 127 | set_random_data(writebuf, mtd->erasesize); |
128 | for (j = 0; j < pgcnt - 1; ++j, addr += pgsize) { | 128 | for (j = 0; j < pgcnt - 1; ++j, addr += pgsize) { |
129 | /* Do a read to set the internal dataRAMs to different data */ | 129 | /* Do a read to set the internal dataRAMs to different data */ |
130 | err = mtd->read(mtd, addr0, bufsize, &read, twopages); | 130 | err = mtd_read(mtd, addr0, bufsize, &read, twopages); |
131 | if (mtd_is_bitflip(err)) | 131 | if (mtd_is_bitflip(err)) |
132 | err = 0; | 132 | err = 0; |
133 | if (err || read != bufsize) { | 133 | if (err || read != bufsize) { |
@@ -135,7 +135,7 @@ static int verify_eraseblock(int ebnum) | |||
135 | (long long)addr0); | 135 | (long long)addr0); |
136 | return err; | 136 | return err; |
137 | } | 137 | } |
138 | err = mtd->read(mtd, addrn - bufsize, bufsize, &read, twopages); | 138 | err = mtd_read(mtd, addrn - bufsize, bufsize, &read, twopages); |
139 | if (mtd_is_bitflip(err)) | 139 | if (mtd_is_bitflip(err)) |
140 | err = 0; | 140 | err = 0; |
141 | if (err || read != bufsize) { | 141 | if (err || read != bufsize) { |
@@ -145,7 +145,7 @@ static int verify_eraseblock(int ebnum) | |||
145 | } | 145 | } |
146 | memset(twopages, 0, bufsize); | 146 | memset(twopages, 0, bufsize); |
147 | read = 0; | 147 | read = 0; |
148 | err = mtd->read(mtd, addr, bufsize, &read, twopages); | 148 | err = mtd_read(mtd, addr, bufsize, &read, twopages); |
149 | if (mtd_is_bitflip(err)) | 149 | if (mtd_is_bitflip(err)) |
150 | err = 0; | 150 | err = 0; |
151 | if (err || read != bufsize) { | 151 | if (err || read != bufsize) { |
@@ -163,7 +163,7 @@ static int verify_eraseblock(int ebnum) | |||
163 | if (addr <= addrn - pgsize - pgsize && !bbt[ebnum + 1]) { | 163 | if (addr <= addrn - pgsize - pgsize && !bbt[ebnum + 1]) { |
164 | unsigned long oldnext = next; | 164 | unsigned long oldnext = next; |
165 | /* Do a read to set the internal dataRAMs to different data */ | 165 | /* Do a read to set the internal dataRAMs to different data */ |
166 | err = mtd->read(mtd, addr0, bufsize, &read, twopages); | 166 | err = mtd_read(mtd, addr0, bufsize, &read, twopages); |
167 | if (mtd_is_bitflip(err)) | 167 | if (mtd_is_bitflip(err)) |
168 | err = 0; | 168 | err = 0; |
169 | if (err || read != bufsize) { | 169 | if (err || read != bufsize) { |
@@ -171,7 +171,7 @@ static int verify_eraseblock(int ebnum) | |||
171 | (long long)addr0); | 171 | (long long)addr0); |
172 | return err; | 172 | return err; |
173 | } | 173 | } |
174 | err = mtd->read(mtd, addrn - bufsize, bufsize, &read, twopages); | 174 | err = mtd_read(mtd, addrn - bufsize, bufsize, &read, twopages); |
175 | if (mtd_is_bitflip(err)) | 175 | if (mtd_is_bitflip(err)) |
176 | err = 0; | 176 | err = 0; |
177 | if (err || read != bufsize) { | 177 | if (err || read != bufsize) { |
@@ -181,7 +181,7 @@ static int verify_eraseblock(int ebnum) | |||
181 | } | 181 | } |
182 | memset(twopages, 0, bufsize); | 182 | memset(twopages, 0, bufsize); |
183 | read = 0; | 183 | read = 0; |
184 | err = mtd->read(mtd, addr, bufsize, &read, twopages); | 184 | err = mtd_read(mtd, addr, bufsize, &read, twopages); |
185 | if (mtd_is_bitflip(err)) | 185 | if (mtd_is_bitflip(err)) |
186 | err = 0; | 186 | err = 0; |
187 | if (err || read != bufsize) { | 187 | if (err || read != bufsize) { |
@@ -230,7 +230,7 @@ static int crosstest(void) | |||
230 | /* Read 2nd-to-last page to pp1 */ | 230 | /* Read 2nd-to-last page to pp1 */ |
231 | read = 0; | 231 | read = 0; |
232 | addr = addrn - pgsize - pgsize; | 232 | addr = addrn - pgsize - pgsize; |
233 | err = mtd->read(mtd, addr, pgsize, &read, pp1); | 233 | err = mtd_read(mtd, addr, pgsize, &read, pp1); |
234 | if (mtd_is_bitflip(err)) | 234 | if (mtd_is_bitflip(err)) |
235 | err = 0; | 235 | err = 0; |
236 | if (err || read != pgsize) { | 236 | if (err || read != pgsize) { |
@@ -243,7 +243,7 @@ static int crosstest(void) | |||
243 | /* Read 3rd-to-last page to pp1 */ | 243 | /* Read 3rd-to-last page to pp1 */ |
244 | read = 0; | 244 | read = 0; |
245 | addr = addrn - pgsize - pgsize - pgsize; | 245 | addr = addrn - pgsize - pgsize - pgsize; |
246 | err = mtd->read(mtd, addr, pgsize, &read, pp1); | 246 | err = mtd_read(mtd, addr, pgsize, &read, pp1); |
247 | if (mtd_is_bitflip(err)) | 247 | if (mtd_is_bitflip(err)) |
248 | err = 0; | 248 | err = 0; |
249 | if (err || read != pgsize) { | 249 | if (err || read != pgsize) { |
@@ -257,7 +257,7 @@ static int crosstest(void) | |||
257 | read = 0; | 257 | read = 0; |
258 | addr = addr0; | 258 | addr = addr0; |
259 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); | 259 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); |
260 | err = mtd->read(mtd, addr, pgsize, &read, pp2); | 260 | err = mtd_read(mtd, addr, pgsize, &read, pp2); |
261 | if (mtd_is_bitflip(err)) | 261 | if (mtd_is_bitflip(err)) |
262 | err = 0; | 262 | err = 0; |
263 | if (err || read != pgsize) { | 263 | if (err || read != pgsize) { |
@@ -271,7 +271,7 @@ static int crosstest(void) | |||
271 | read = 0; | 271 | read = 0; |
272 | addr = addrn - pgsize; | 272 | addr = addrn - pgsize; |
273 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); | 273 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); |
274 | err = mtd->read(mtd, addr, pgsize, &read, pp3); | 274 | err = mtd_read(mtd, addr, pgsize, &read, pp3); |
275 | if (mtd_is_bitflip(err)) | 275 | if (mtd_is_bitflip(err)) |
276 | err = 0; | 276 | err = 0; |
277 | if (err || read != pgsize) { | 277 | if (err || read != pgsize) { |
@@ -285,7 +285,7 @@ static int crosstest(void) | |||
285 | read = 0; | 285 | read = 0; |
286 | addr = addr0; | 286 | addr = addr0; |
287 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); | 287 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); |
288 | err = mtd->read(mtd, addr, pgsize, &read, pp4); | 288 | err = mtd_read(mtd, addr, pgsize, &read, pp4); |
289 | if (mtd_is_bitflip(err)) | 289 | if (mtd_is_bitflip(err)) |
290 | err = 0; | 290 | err = 0; |
291 | if (err || read != pgsize) { | 291 | if (err || read != pgsize) { |
@@ -344,7 +344,7 @@ static int erasecrosstest(void) | |||
344 | 344 | ||
345 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); | 345 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); |
346 | memset(readbuf, 0, pgsize); | 346 | memset(readbuf, 0, pgsize); |
347 | err = mtd->read(mtd, addr0, pgsize, &read, readbuf); | 347 | err = mtd_read(mtd, addr0, pgsize, &read, readbuf); |
348 | if (mtd_is_bitflip(err)) | 348 | if (mtd_is_bitflip(err)) |
349 | err = 0; | 349 | err = 0; |
350 | if (err || read != pgsize) { | 350 | if (err || read != pgsize) { |
@@ -382,7 +382,7 @@ static int erasecrosstest(void) | |||
382 | 382 | ||
383 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); | 383 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); |
384 | memset(readbuf, 0, pgsize); | 384 | memset(readbuf, 0, pgsize); |
385 | err = mtd->read(mtd, addr0, pgsize, &read, readbuf); | 385 | err = mtd_read(mtd, addr0, pgsize, &read, readbuf); |
386 | if (mtd_is_bitflip(err)) | 386 | if (mtd_is_bitflip(err)) |
387 | err = 0; | 387 | err = 0; |
388 | if (err || read != pgsize) { | 388 | if (err || read != pgsize) { |
@@ -438,7 +438,7 @@ static int erasetest(void) | |||
438 | return err; | 438 | return err; |
439 | 439 | ||
440 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); | 440 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); |
441 | err = mtd->read(mtd, addr0, pgsize, &read, twopages); | 441 | err = mtd_read(mtd, addr0, pgsize, &read, twopages); |
442 | if (mtd_is_bitflip(err)) | 442 | if (mtd_is_bitflip(err)) |
443 | err = 0; | 443 | err = 0; |
444 | if (err || read != pgsize) { | 444 | if (err || read != pgsize) { |
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c index 550fe51225a7..0c58d2976c76 100644 --- a/drivers/mtd/tests/mtd_readtest.c +++ b/drivers/mtd/tests/mtd_readtest.c | |||
@@ -52,7 +52,7 @@ static int read_eraseblock_by_page(int ebnum) | |||
52 | 52 | ||
53 | for (i = 0; i < pgcnt; i++) { | 53 | for (i = 0; i < pgcnt; i++) { |
54 | memset(buf, 0 , pgcnt); | 54 | memset(buf, 0 , pgcnt); |
55 | ret = mtd->read(mtd, addr, pgsize, &read, buf); | 55 | ret = mtd_read(mtd, addr, pgsize, &read, buf); |
56 | if (ret == -EUCLEAN) | 56 | if (ret == -EUCLEAN) |
57 | ret = 0; | 57 | ret = 0; |
58 | if (ret || read != pgsize) { | 58 | if (ret || read != pgsize) { |
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c index f67a65e21043..3c9529bd0a62 100644 --- a/drivers/mtd/tests/mtd_speedtest.c +++ b/drivers/mtd/tests/mtd_speedtest.c | |||
@@ -214,7 +214,7 @@ static int read_eraseblock(int ebnum) | |||
214 | int err = 0; | 214 | int err = 0; |
215 | loff_t addr = ebnum * mtd->erasesize; | 215 | loff_t addr = ebnum * mtd->erasesize; |
216 | 216 | ||
217 | err = mtd->read(mtd, addr, mtd->erasesize, &read, iobuf); | 217 | err = mtd_read(mtd, addr, mtd->erasesize, &read, iobuf); |
218 | /* Ignore corrected ECC errors */ | 218 | /* Ignore corrected ECC errors */ |
219 | if (mtd_is_bitflip(err)) | 219 | if (mtd_is_bitflip(err)) |
220 | err = 0; | 220 | err = 0; |
@@ -235,7 +235,7 @@ static int read_eraseblock_by_page(int ebnum) | |||
235 | void *buf = iobuf; | 235 | void *buf = iobuf; |
236 | 236 | ||
237 | for (i = 0; i < pgcnt; i++) { | 237 | for (i = 0; i < pgcnt; i++) { |
238 | err = mtd->read(mtd, addr, pgsize, &read, buf); | 238 | err = mtd_read(mtd, addr, pgsize, &read, buf); |
239 | /* Ignore corrected ECC errors */ | 239 | /* Ignore corrected ECC errors */ |
240 | if (mtd_is_bitflip(err)) | 240 | if (mtd_is_bitflip(err)) |
241 | err = 0; | 241 | err = 0; |
@@ -261,7 +261,7 @@ static int read_eraseblock_by_2pages(int ebnum) | |||
261 | void *buf = iobuf; | 261 | void *buf = iobuf; |
262 | 262 | ||
263 | for (i = 0; i < n; i++) { | 263 | for (i = 0; i < n; i++) { |
264 | err = mtd->read(mtd, addr, sz, &read, buf); | 264 | err = mtd_read(mtd, addr, sz, &read, buf); |
265 | /* Ignore corrected ECC errors */ | 265 | /* Ignore corrected ECC errors */ |
266 | if (mtd_is_bitflip(err)) | 266 | if (mtd_is_bitflip(err)) |
267 | err = 0; | 267 | err = 0; |
@@ -276,7 +276,7 @@ static int read_eraseblock_by_2pages(int ebnum) | |||
276 | buf += sz; | 276 | buf += sz; |
277 | } | 277 | } |
278 | if (pgcnt % 2) { | 278 | if (pgcnt % 2) { |
279 | err = mtd->read(mtd, addr, pgsize, &read, buf); | 279 | err = mtd_read(mtd, addr, pgsize, &read, buf); |
280 | /* Ignore corrected ECC errors */ | 280 | /* Ignore corrected ECC errors */ |
281 | if (mtd_is_bitflip(err)) | 281 | if (mtd_is_bitflip(err)) |
282 | err = 0; | 282 | err = 0; |
diff --git a/drivers/mtd/tests/mtd_stresstest.c b/drivers/mtd/tests/mtd_stresstest.c index a204a9f90524..83a843723880 100644 --- a/drivers/mtd/tests/mtd_stresstest.c +++ b/drivers/mtd/tests/mtd_stresstest.c | |||
@@ -153,7 +153,7 @@ static int do_read(void) | |||
153 | len = mtd->erasesize - offs; | 153 | len = mtd->erasesize - offs; |
154 | } | 154 | } |
155 | addr = eb * mtd->erasesize + offs; | 155 | addr = eb * mtd->erasesize + offs; |
156 | err = mtd->read(mtd, addr, len, &read, readbuf); | 156 | err = mtd_read(mtd, addr, len, &read, readbuf); |
157 | if (mtd_is_bitflip(err)) | 157 | if (mtd_is_bitflip(err)) |
158 | err = 0; | 158 | err = 0; |
159 | if (unlikely(err || read != len)) { | 159 | if (unlikely(err || read != len)) { |
diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c index 16d0c05024d7..d81f89a19daa 100644 --- a/drivers/mtd/tests/mtd_subpagetest.c +++ b/drivers/mtd/tests/mtd_subpagetest.c | |||
@@ -196,7 +196,7 @@ static int verify_eraseblock(int ebnum) | |||
196 | set_random_data(writebuf, subpgsize); | 196 | set_random_data(writebuf, subpgsize); |
197 | clear_data(readbuf, subpgsize); | 197 | clear_data(readbuf, subpgsize); |
198 | read = 0; | 198 | read = 0; |
199 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); | 199 | err = mtd_read(mtd, addr, subpgsize, &read, readbuf); |
200 | if (unlikely(err || read != subpgsize)) { | 200 | if (unlikely(err || read != subpgsize)) { |
201 | if (mtd_is_bitflip(err) && read == subpgsize) { | 201 | if (mtd_is_bitflip(err) && read == subpgsize) { |
202 | printk(PRINT_PREF "ECC correction at %#llx\n", | 202 | printk(PRINT_PREF "ECC correction at %#llx\n", |
@@ -224,7 +224,7 @@ static int verify_eraseblock(int ebnum) | |||
224 | set_random_data(writebuf, subpgsize); | 224 | set_random_data(writebuf, subpgsize); |
225 | clear_data(readbuf, subpgsize); | 225 | clear_data(readbuf, subpgsize); |
226 | read = 0; | 226 | read = 0; |
227 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); | 227 | err = mtd_read(mtd, addr, subpgsize, &read, readbuf); |
228 | if (unlikely(err || read != subpgsize)) { | 228 | if (unlikely(err || read != subpgsize)) { |
229 | if (mtd_is_bitflip(err) && read == subpgsize) { | 229 | if (mtd_is_bitflip(err) && read == subpgsize) { |
230 | printk(PRINT_PREF "ECC correction at %#llx\n", | 230 | printk(PRINT_PREF "ECC correction at %#llx\n", |
@@ -262,7 +262,7 @@ static int verify_eraseblock2(int ebnum) | |||
262 | set_random_data(writebuf, subpgsize * k); | 262 | set_random_data(writebuf, subpgsize * k); |
263 | clear_data(readbuf, subpgsize * k); | 263 | clear_data(readbuf, subpgsize * k); |
264 | read = 0; | 264 | read = 0; |
265 | err = mtd->read(mtd, addr, subpgsize * k, &read, readbuf); | 265 | err = mtd_read(mtd, addr, subpgsize * k, &read, readbuf); |
266 | if (unlikely(err || read != subpgsize * k)) { | 266 | if (unlikely(err || read != subpgsize * k)) { |
267 | if (mtd_is_bitflip(err) && read == subpgsize * k) { | 267 | if (mtd_is_bitflip(err) && read == subpgsize * k) { |
268 | printk(PRINT_PREF "ECC correction at %#llx\n", | 268 | printk(PRINT_PREF "ECC correction at %#llx\n", |
@@ -296,7 +296,7 @@ static int verify_eraseblock_ff(int ebnum) | |||
296 | for (j = 0; j < mtd->erasesize / subpgsize; ++j) { | 296 | for (j = 0; j < mtd->erasesize / subpgsize; ++j) { |
297 | clear_data(readbuf, subpgsize); | 297 | clear_data(readbuf, subpgsize); |
298 | read = 0; | 298 | read = 0; |
299 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); | 299 | err = mtd_read(mtd, addr, subpgsize, &read, readbuf); |
300 | if (unlikely(err || read != subpgsize)) { | 300 | if (unlikely(err || read != subpgsize)) { |
301 | if (mtd_is_bitflip(err) && read == subpgsize) { | 301 | if (mtd_is_bitflip(err) && read == subpgsize) { |
302 | printk(PRINT_PREF "ECC correction at %#llx\n", | 302 | printk(PRINT_PREF "ECC correction at %#llx\n", |
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c index 102c79b7ac66..ecc68bf3f3f2 100644 --- a/drivers/mtd/tests/mtd_torturetest.c +++ b/drivers/mtd/tests/mtd_torturetest.c | |||
@@ -137,7 +137,7 @@ static inline int check_eraseblock(int ebnum, unsigned char *buf) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | retry: | 139 | retry: |
140 | err = mtd->read(mtd, addr, len, &read, check_buf); | 140 | err = mtd_read(mtd, addr, len, &read, check_buf); |
141 | if (mtd_is_bitflip(err)) | 141 | if (mtd_is_bitflip(err)) |
142 | printk(PRINT_PREF "single bit flip occurred at EB %d " | 142 | printk(PRINT_PREF "single bit flip occurred at EB %d " |
143 | "MTD reported that it was fixed.\n", ebnum); | 143 | "MTD reported that it was fixed.\n", ebnum); |