aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-07 12:11:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-07 12:11:16 -0500
commite0d65113a70f1dc514e625cc4e7a7485a4bf72df (patch)
tree7320a130dc304623f5cf4b5dd8f67fb1776225ca /drivers/mtd/ubi
parentcf5e15fbd72c13977720aa15b7b7e00e1d8fd8f2 (diff)
parent48e546b7f281f251893baa40769581fd15f085fb (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (226 commits) mtd: tests: annotate as DANGEROUS in Kconfig mtd: tests: don't use mtd0 as a default mtd: clean up usage of MTD_DOCPROBE_ADDRESS jffs2: add compr=lzo and compr=zlib options jffs2: implement mount option parsing and compression overriding mtd: nand: initialize ops.mode mtd: provide an alias for the redboot module name mtd: m25p80: don't probe device which has status of 'disabled' mtd: nand_h1900 never worked mtd: Add DiskOnChip G3 support mtd: m25p80: add EON flash EN25Q32B into spi flash id table mtd: mark block device queue as non-rotational mtd: r852: make r852_pm_ops static mtd: m25p80: add support for at25df321a spi data flash mtd: mxc_nand: preset_v1_v2: unlock all NAND flash blocks mtd: nand: switch `check_pattern()' to standard `memcmp()' mtd: nand: invalidate cache on unaligned reads mtd: nand: do not scan bad blocks with NAND_BBT_NO_OOB set mtd: nand: wait to set BBT version mtd: nand: scrub BBT on ECC errors ... Fix up trivial conflicts: - arch/arm/mach-at91/board-usb-a9260.c Merged into board-usb-a926x.c - drivers/mtd/maps/lantiq-flash.c add_mtd_partitions -> mtd_device_register vs changed to use mtd_device_parse_register.
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/eba.c2
-rw-r--r--drivers/mtd/ubi/io.c24
-rw-r--r--drivers/mtd/ubi/kapi.c2
-rw-r--r--drivers/mtd/ubi/misc.c2
-rw-r--r--drivers/mtd/ubi/scan.c4
-rw-r--r--drivers/mtd/ubi/vtbl.c2
6 files changed, 18 insertions, 18 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 4be671815014..fb7f19b62d91 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -443,7 +443,7 @@ retry:
443 if (err == UBI_IO_BITFLIPS) { 443 if (err == UBI_IO_BITFLIPS) {
444 scrub = 1; 444 scrub = 1;
445 err = 0; 445 err = 0;
446 } else if (err == -EBADMSG) { 446 } else if (mtd_is_eccerr(err)) {
447 if (vol->vol_type == UBI_DYNAMIC_VOLUME) 447 if (vol->vol_type == UBI_DYNAMIC_VOLUME)
448 goto out_unlock; 448 goto out_unlock;
449 scrub = 1; 449 scrub = 1;
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 6ba55c235873..f20b6f22f240 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -172,9 +172,9 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset,
172retry: 172retry:
173 err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); 173 err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf);
174 if (err) { 174 if (err) {
175 const char *errstr = (err == -EBADMSG) ? " (ECC error)" : ""; 175 const char *errstr = mtd_is_eccerr(err) ? " (ECC error)" : "";
176 176
177 if (err == -EUCLEAN) { 177 if (mtd_is_bitflip(err)) {
178 /* 178 /*
179 * -EUCLEAN is reported if there was a bit-flip which 179 * -EUCLEAN is reported if there was a bit-flip which
180 * was corrected, so this is harmless. 180 * was corrected, so this is harmless.
@@ -205,7 +205,7 @@ retry:
205 * all the requested data. But some buggy drivers might do 205 * all the requested data. But some buggy drivers might do
206 * this, so we change it to -EIO. 206 * this, so we change it to -EIO.
207 */ 207 */
208 if (read != len && err == -EBADMSG) { 208 if (read != len && mtd_is_eccerr(err)) {
209 ubi_assert(0); 209 ubi_assert(0);
210 err = -EIO; 210 err = -EIO;
211 } 211 }
@@ -469,7 +469,7 @@ static int torture_peb(struct ubi_device *ubi, int pnum)
469 469
470out: 470out:
471 mutex_unlock(&ubi->buf_mutex); 471 mutex_unlock(&ubi->buf_mutex);
472 if (err == UBI_IO_BITFLIPS || err == -EBADMSG) { 472 if (err == UBI_IO_BITFLIPS || mtd_is_eccerr(err)) {
473 /* 473 /*
474 * If a bit-flip or data integrity error was detected, the test 474 * If a bit-flip or data integrity error was detected, the test
475 * has not passed because it happened on a freshly erased 475 * has not passed because it happened on a freshly erased
@@ -760,7 +760,7 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
760 760
761 read_err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE); 761 read_err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE);
762 if (read_err) { 762 if (read_err) {
763 if (read_err != UBI_IO_BITFLIPS && read_err != -EBADMSG) 763 if (read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
764 return read_err; 764 return read_err;
765 765
766 /* 766 /*
@@ -776,7 +776,7 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
776 776
777 magic = be32_to_cpu(ec_hdr->magic); 777 magic = be32_to_cpu(ec_hdr->magic);
778 if (magic != UBI_EC_HDR_MAGIC) { 778 if (magic != UBI_EC_HDR_MAGIC) {
779 if (read_err == -EBADMSG) 779 if (mtd_is_eccerr(read_err))
780 return UBI_IO_BAD_HDR_EBADMSG; 780 return UBI_IO_BAD_HDR_EBADMSG;
781 781
782 /* 782 /*
@@ -1032,12 +1032,12 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
1032 p = (char *)vid_hdr - ubi->vid_hdr_shift; 1032 p = (char *)vid_hdr - ubi->vid_hdr_shift;
1033 read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, 1033 read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
1034 ubi->vid_hdr_alsize); 1034 ubi->vid_hdr_alsize);
1035 if (read_err && read_err != UBI_IO_BITFLIPS && read_err != -EBADMSG) 1035 if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
1036 return read_err; 1036 return read_err;
1037 1037
1038 magic = be32_to_cpu(vid_hdr->magic); 1038 magic = be32_to_cpu(vid_hdr->magic);
1039 if (magic != UBI_VID_HDR_MAGIC) { 1039 if (magic != UBI_VID_HDR_MAGIC) {
1040 if (read_err == -EBADMSG) 1040 if (mtd_is_eccerr(read_err))
1041 return UBI_IO_BAD_HDR_EBADMSG; 1041 return UBI_IO_BAD_HDR_EBADMSG;
1042 1042
1043 if (ubi_check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { 1043 if (ubi_check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) {
@@ -1219,7 +1219,7 @@ static int paranoid_check_peb_ec_hdr(const struct ubi_device *ubi, int pnum)
1219 return -ENOMEM; 1219 return -ENOMEM;
1220 1220
1221 err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE); 1221 err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE);
1222 if (err && err != UBI_IO_BITFLIPS && err != -EBADMSG) 1222 if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err))
1223 goto exit; 1223 goto exit;
1224 1224
1225 crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC); 1225 crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC);
@@ -1306,7 +1306,7 @@ static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum)
1306 p = (char *)vid_hdr - ubi->vid_hdr_shift; 1306 p = (char *)vid_hdr - ubi->vid_hdr_shift;
1307 err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset, 1307 err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
1308 ubi->vid_hdr_alsize); 1308 ubi->vid_hdr_alsize);
1309 if (err && err != UBI_IO_BITFLIPS && err != -EBADMSG) 1309 if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err))
1310 goto exit; 1310 goto exit;
1311 1311
1312 crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_EC_HDR_SIZE_CRC); 1312 crc = crc32(UBI_CRC32_INIT, vid_hdr, UBI_EC_HDR_SIZE_CRC);
@@ -1358,7 +1358,7 @@ int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum,
1358 } 1358 }
1359 1359
1360 err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf1); 1360 err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf1);
1361 if (err && err != -EUCLEAN) 1361 if (err && !mtd_is_bitflip(err))
1362 goto out_free; 1362 goto out_free;
1363 1363
1364 for (i = 0; i < len; i++) { 1364 for (i = 0; i < len; i++) {
@@ -1422,7 +1422,7 @@ int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len)
1422 } 1422 }
1423 1423
1424 err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf); 1424 err = ubi->mtd->read(ubi->mtd, addr, len, &read, buf);
1425 if (err && err != -EUCLEAN) { 1425 if (err && !mtd_is_bitflip(err)) {
1426 ubi_err("error %d while reading %d bytes from PEB %d:%d, " 1426 ubi_err("error %d while reading %d bytes from PEB %d:%d, "
1427 "read %zd bytes", err, len, pnum, offset, read); 1427 "read %zd bytes", err, len, pnum, offset, read);
1428 goto error; 1428 goto error;
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index d39716e5b204..1a35fc5e3b40 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -410,7 +410,7 @@ int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
410 return 0; 410 return 0;
411 411
412 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); 412 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check);
413 if (err && err == -EBADMSG && vol->vol_type == UBI_STATIC_VOLUME) { 413 if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
414 ubi_warn("mark volume %d as corrupted", vol_id); 414 ubi_warn("mark volume %d as corrupted", vol_id);
415 vol->corrupted = 1; 415 vol->corrupted = 1;
416 } 416 }
diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c
index ff2a65c37f69..f6a7d7ac4b98 100644
--- a/drivers/mtd/ubi/misc.c
+++ b/drivers/mtd/ubi/misc.c
@@ -81,7 +81,7 @@ int ubi_check_volume(struct ubi_device *ubi, int vol_id)
81 81
82 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); 82 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1);
83 if (err) { 83 if (err) {
84 if (err == -EBADMSG) 84 if (mtd_is_eccerr(err))
85 err = 1; 85 err = 1;
86 break; 86 break;
87 } 87 }
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index a3a198f9b98d..0cb17d936b5a 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -395,7 +395,7 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_scan_leb *seb,
395 } 395 }
396 396
397 err = ubi_io_read_data(ubi, buf, pnum, 0, len); 397 err = ubi_io_read_data(ubi, buf, pnum, 0, len);
398 if (err && err != UBI_IO_BITFLIPS && err != -EBADMSG) 398 if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err))
399 goto out_free_buf; 399 goto out_free_buf;
400 400
401 data_crc = be32_to_cpu(vid_hdr->data_crc); 401 data_crc = be32_to_cpu(vid_hdr->data_crc);
@@ -793,7 +793,7 @@ static int check_corruption(struct ubi_device *ubi, struct ubi_vid_hdr *vid_hdr,
793 793
794 err = ubi_io_read(ubi, ubi->peb_buf1, pnum, ubi->leb_start, 794 err = ubi_io_read(ubi, ubi->peb_buf1, pnum, ubi->leb_start,
795 ubi->leb_size); 795 ubi->leb_size);
796 if (err == UBI_IO_BITFLIPS || err == -EBADMSG) { 796 if (err == UBI_IO_BITFLIPS || mtd_is_eccerr(err)) {
797 /* 797 /*
798 * Bit-flips or integrity errors while reading the data area. 798 * Bit-flips or integrity errors while reading the data area.
799 * It is difficult to say for sure what type of corruption is 799 * It is difficult to say for sure what type of corruption is
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 4b50a3029b84..9ad18da1891d 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -423,7 +423,7 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
423 423
424 err = ubi_io_read_data(ubi, leb[seb->lnum], seb->pnum, 0, 424 err = ubi_io_read_data(ubi, leb[seb->lnum], seb->pnum, 0,
425 ubi->vtbl_size); 425 ubi->vtbl_size);
426 if (err == UBI_IO_BITFLIPS || err == -EBADMSG) 426 if (err == UBI_IO_BITFLIPS || mtd_is_eccerr(err))
427 /* 427 /*
428 * Scrub the PEB later. Note, -EBADMSG indicates an 428 * Scrub the PEB later. Note, -EBADMSG indicates an
429 * uncorrectable ECC error, but we have our own CRC and 429 * uncorrectable ECC error, but we have our own CRC and