diff options
author | Brian Norris <computersforpeace@gmail.com> | 2011-09-20 21:34:25 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-21 02:19:06 -0400 |
commit | d57f40544a41fdfe90fd863b6865138c5a82f1cc (patch) | |
tree | 4d5e8f6d0a62e8fa06ccfabd13fe9364b19db1b5 /drivers/mtd/mtdswap.c | |
parent | 7387ce773256f446bdd0280b2449b635441f906e (diff) |
mtd: utilize `mtd_is_*()' functions
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'drivers/mtd/mtdswap.c')
-rw-r--r-- | drivers/mtd/mtdswap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index 910309f260f8..bd9590c723e4 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c | |||
@@ -314,7 +314,7 @@ static int mtdswap_read_oob(struct mtdswap_dev *d, loff_t from, | |||
314 | { | 314 | { |
315 | int ret = d->mtd->read_oob(d->mtd, from, ops); | 315 | int ret = d->mtd->read_oob(d->mtd, from, ops); |
316 | 316 | ||
317 | if (ret == -EUCLEAN) | 317 | if (mtd_is_bitflip(ret)) |
318 | return ret; | 318 | return ret; |
319 | 319 | ||
320 | if (ret) { | 320 | if (ret) { |
@@ -354,7 +354,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb) | |||
354 | 354 | ||
355 | ret = mtdswap_read_oob(d, offset, &ops); | 355 | ret = mtdswap_read_oob(d, offset, &ops); |
356 | 356 | ||
357 | if (ret && ret != -EUCLEAN) | 357 | if (ret && !mtd_is_bitflip(ret)) |
358 | return ret; | 358 | return ret; |
359 | 359 | ||
360 | data = (struct mtdswap_oobdata *)d->oob_buf; | 360 | data = (struct mtdswap_oobdata *)d->oob_buf; |
@@ -363,7 +363,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb) | |||
363 | 363 | ||
364 | if (le16_to_cpu(data->magic) == MTDSWAP_MAGIC_CLEAN) { | 364 | if (le16_to_cpu(data->magic) == MTDSWAP_MAGIC_CLEAN) { |
365 | eb->erase_count = le32_to_cpu(data->count); | 365 | eb->erase_count = le32_to_cpu(data->count); |
366 | if (ret == -EUCLEAN) | 366 | if (mtd_is_bitflip(ret)) |
367 | ret = MTDSWAP_SCANNED_BITFLIP; | 367 | ret = MTDSWAP_SCANNED_BITFLIP; |
368 | else { | 368 | else { |
369 | if (le16_to_cpu(data2->magic) == MTDSWAP_MAGIC_DIRTY) | 369 | if (le16_to_cpu(data2->magic) == MTDSWAP_MAGIC_DIRTY) |
@@ -408,7 +408,7 @@ static int mtdswap_write_marker(struct mtdswap_dev *d, struct swap_eb *eb, | |||
408 | if (ret) { | 408 | if (ret) { |
409 | dev_warn(d->dev, "Write OOB failed for block at %08llx " | 409 | dev_warn(d->dev, "Write OOB failed for block at %08llx " |
410 | "error %d\n", offset, ret); | 410 | "error %d\n", offset, ret); |
411 | if (ret == -EIO || ret == -EBADMSG) | 411 | if (ret == -EIO || mtd_is_eccerr(ret)) |
412 | mtdswap_handle_write_error(d, eb); | 412 | mtdswap_handle_write_error(d, eb); |
413 | return ret; | 413 | return ret; |
414 | } | 414 | } |
@@ -628,7 +628,7 @@ static int mtdswap_map_free_block(struct mtdswap_dev *d, unsigned int page, | |||
628 | TREE_COUNT(d, CLEAN)--; | 628 | TREE_COUNT(d, CLEAN)--; |
629 | 629 | ||
630 | ret = mtdswap_write_marker(d, eb, MTDSWAP_TYPE_DIRTY); | 630 | ret = mtdswap_write_marker(d, eb, MTDSWAP_TYPE_DIRTY); |
631 | } while (ret == -EIO || ret == -EBADMSG); | 631 | } while (ret == -EIO || mtd_is_eccerr(ret)); |
632 | 632 | ||
633 | if (ret) | 633 | if (ret) |
634 | return ret; | 634 | return ret; |
@@ -678,7 +678,7 @@ retry: | |||
678 | ret = mtdswap_map_free_block(d, page, bp); | 678 | ret = mtdswap_map_free_block(d, page, bp); |
679 | eb = d->eb_data + (*bp / d->pages_per_eblk); | 679 | eb = d->eb_data + (*bp / d->pages_per_eblk); |
680 | 680 | ||
681 | if (ret == -EIO || ret == -EBADMSG) { | 681 | if (ret == -EIO || mtd_is_eccerr(ret)) { |
682 | d->curr_write = NULL; | 682 | d->curr_write = NULL; |
683 | eb->active_count--; | 683 | eb->active_count--; |
684 | d->revmap[*bp] = PAGE_UNDEF; | 684 | d->revmap[*bp] = PAGE_UNDEF; |
@@ -690,7 +690,7 @@ retry: | |||
690 | 690 | ||
691 | writepos = (loff_t)*bp << PAGE_SHIFT; | 691 | writepos = (loff_t)*bp << PAGE_SHIFT; |
692 | ret = mtd->write(mtd, writepos, PAGE_SIZE, &retlen, buf); | 692 | ret = mtd->write(mtd, writepos, PAGE_SIZE, &retlen, buf); |
693 | if (ret == -EIO || ret == -EBADMSG) { | 693 | if (ret == -EIO || mtd_is_eccerr(ret)) { |
694 | d->curr_write_pos--; | 694 | d->curr_write_pos--; |
695 | eb->active_count--; | 695 | eb->active_count--; |
696 | d->revmap[*bp] = PAGE_UNDEF; | 696 | d->revmap[*bp] = PAGE_UNDEF; |
@@ -738,7 +738,7 @@ static int mtdswap_move_block(struct mtdswap_dev *d, unsigned int oldblock, | |||
738 | retry: | 738 | retry: |
739 | ret = mtd->read(mtd, readpos, PAGE_SIZE, &retlen, d->page_buf); | 739 | ret = mtd->read(mtd, readpos, PAGE_SIZE, &retlen, d->page_buf); |
740 | 740 | ||
741 | if (ret < 0 && ret != -EUCLEAN) { | 741 | if (ret < 0 && !mtd_is_bitflip(ret)) { |
742 | oldeb = d->eb_data + oldblock / d->pages_per_eblk; | 742 | oldeb = d->eb_data + oldblock / d->pages_per_eblk; |
743 | oldeb->flags |= EBLOCK_READERR; | 743 | oldeb->flags |= EBLOCK_READERR; |
744 | 744 | ||
@@ -1016,7 +1016,7 @@ static int mtdswap_gc(struct mtdswap_dev *d, unsigned int background) | |||
1016 | 1016 | ||
1017 | if (ret == 0) | 1017 | if (ret == 0) |
1018 | mtdswap_rb_add(d, eb, MTDSWAP_CLEAN); | 1018 | mtdswap_rb_add(d, eb, MTDSWAP_CLEAN); |
1019 | else if (ret != -EIO && ret != -EBADMSG) | 1019 | else if (ret != -EIO && !mtd_is_eccerr(ret)) |
1020 | mtdswap_rb_add(d, eb, MTDSWAP_DIRTY); | 1020 | mtdswap_rb_add(d, eb, MTDSWAP_DIRTY); |
1021 | 1021 | ||
1022 | return 0; | 1022 | return 0; |
@@ -1164,7 +1164,7 @@ retry: | |||
1164 | ret = mtd->read(mtd, readpos, PAGE_SIZE, &retlen, buf); | 1164 | ret = mtd->read(mtd, readpos, PAGE_SIZE, &retlen, buf); |
1165 | 1165 | ||
1166 | d->mtd_read_count++; | 1166 | d->mtd_read_count++; |
1167 | if (ret == -EUCLEAN) { | 1167 | if (mtd_is_bitflip(ret)) { |
1168 | eb->flags |= EBLOCK_BITFLIP; | 1168 | eb->flags |= EBLOCK_BITFLIP; |
1169 | mtdswap_rb_add(d, eb, MTDSWAP_BITFLIP); | 1169 | mtdswap_rb_add(d, eb, MTDSWAP_BITFLIP); |
1170 | ret = 0; | 1170 | ret = 0; |