diff options
Diffstat (limited to 'drivers/mtd/mtdswap.c')
-rw-r--r-- | drivers/mtd/mtdswap.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index bd9590c723e4..c92f0f6bc130 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c | |||
@@ -274,12 +274,12 @@ static int mtdswap_handle_badblock(struct mtdswap_dev *d, struct swap_eb *eb) | |||
274 | eb->root = NULL; | 274 | eb->root = NULL; |
275 | 275 | ||
276 | /* badblocks not supported */ | 276 | /* badblocks not supported */ |
277 | if (!d->mtd->block_markbad) | 277 | if (!mtd_can_have_bb(d->mtd)) |
278 | return 1; | 278 | return 1; |
279 | 279 | ||
280 | offset = mtdswap_eb_offset(d, eb); | 280 | offset = mtdswap_eb_offset(d, eb); |
281 | dev_warn(d->dev, "Marking bad block at %08llx\n", offset); | 281 | dev_warn(d->dev, "Marking bad block at %08llx\n", offset); |
282 | ret = d->mtd->block_markbad(d->mtd, offset); | 282 | ret = mtd_block_markbad(d->mtd, offset); |
283 | 283 | ||
284 | if (ret) { | 284 | if (ret) { |
285 | dev_warn(d->dev, "Mark block bad failed for block at %08llx " | 285 | dev_warn(d->dev, "Mark block bad failed for block at %08llx " |
@@ -312,7 +312,7 @@ static int mtdswap_handle_write_error(struct mtdswap_dev *d, struct swap_eb *eb) | |||
312 | static int mtdswap_read_oob(struct mtdswap_dev *d, loff_t from, | 312 | static int mtdswap_read_oob(struct mtdswap_dev *d, loff_t from, |
313 | struct mtd_oob_ops *ops) | 313 | struct mtd_oob_ops *ops) |
314 | { | 314 | { |
315 | int ret = d->mtd->read_oob(d->mtd, from, ops); | 315 | int ret = mtd_read_oob(d->mtd, from, ops); |
316 | 316 | ||
317 | if (mtd_is_bitflip(ret)) | 317 | if (mtd_is_bitflip(ret)) |
318 | return ret; | 318 | return ret; |
@@ -343,7 +343,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb) | |||
343 | offset = mtdswap_eb_offset(d, eb); | 343 | offset = mtdswap_eb_offset(d, eb); |
344 | 344 | ||
345 | /* Check first if the block is bad. */ | 345 | /* Check first if the block is bad. */ |
346 | if (d->mtd->block_isbad && d->mtd->block_isbad(d->mtd, offset)) | 346 | if (mtd_can_have_bb(d->mtd) && mtd_block_isbad(d->mtd, offset)) |
347 | return MTDSWAP_SCANNED_BAD; | 347 | return MTDSWAP_SCANNED_BAD; |
348 | 348 | ||
349 | ops.ooblen = 2 * d->mtd->ecclayout->oobavail; | 349 | ops.ooblen = 2 * d->mtd->ecclayout->oobavail; |
@@ -403,7 +403,7 @@ static int mtdswap_write_marker(struct mtdswap_dev *d, struct swap_eb *eb, | |||
403 | offset = mtdswap_eb_offset(d, eb) + d->mtd->writesize; | 403 | offset = mtdswap_eb_offset(d, eb) + d->mtd->writesize; |
404 | } | 404 | } |
405 | 405 | ||
406 | ret = d->mtd->write_oob(d->mtd, offset , &ops); | 406 | ret = mtd_write_oob(d->mtd, offset, &ops); |
407 | 407 | ||
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 " |
@@ -567,7 +567,7 @@ retry: | |||
567 | erase.len = mtd->erasesize; | 567 | erase.len = mtd->erasesize; |
568 | erase.priv = (u_long)&wq; | 568 | erase.priv = (u_long)&wq; |
569 | 569 | ||
570 | ret = mtd->erase(mtd, &erase); | 570 | ret = mtd_erase(mtd, &erase); |
571 | if (ret) { | 571 | if (ret) { |
572 | if (retries++ < MTDSWAP_ERASE_RETRIES) { | 572 | if (retries++ < MTDSWAP_ERASE_RETRIES) { |
573 | dev_warn(d->dev, | 573 | dev_warn(d->dev, |
@@ -689,7 +689,7 @@ retry: | |||
689 | return ret; | 689 | return ret; |
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 || mtd_is_eccerr(ret)) { | 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--; |
@@ -736,7 +736,7 @@ static int mtdswap_move_block(struct mtdswap_dev *d, unsigned int oldblock, | |||
736 | retries = 0; | 736 | retries = 0; |
737 | 737 | ||
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 && !mtd_is_bitflip(ret)) { | 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; |
@@ -946,7 +946,7 @@ static unsigned int mtdswap_eblk_passes(struct mtdswap_dev *d, | |||
946 | patt = mtdswap_test_patt(test + i); | 946 | patt = mtdswap_test_patt(test + i); |
947 | memset(d->page_buf, patt, mtd->writesize); | 947 | memset(d->page_buf, patt, mtd->writesize); |
948 | memset(d->oob_buf, patt, mtd->ecclayout->oobavail); | 948 | memset(d->oob_buf, patt, mtd->ecclayout->oobavail); |
949 | ret = mtd->write_oob(mtd, pos, &ops); | 949 | ret = mtd_write_oob(mtd, pos, &ops); |
950 | if (ret) | 950 | if (ret) |
951 | goto error; | 951 | goto error; |
952 | 952 | ||
@@ -955,7 +955,7 @@ static unsigned int mtdswap_eblk_passes(struct mtdswap_dev *d, | |||
955 | 955 | ||
956 | pos = base; | 956 | pos = base; |
957 | for (i = 0; i < mtd_pages; i++) { | 957 | for (i = 0; i < mtd_pages; i++) { |
958 | ret = mtd->read_oob(mtd, pos, &ops); | 958 | ret = mtd_read_oob(mtd, pos, &ops); |
959 | if (ret) | 959 | if (ret) |
960 | goto error; | 960 | goto error; |
961 | 961 | ||
@@ -1047,8 +1047,7 @@ static int mtdswap_flush(struct mtd_blktrans_dev *dev) | |||
1047 | { | 1047 | { |
1048 | struct mtdswap_dev *d = MTDSWAP_MBD_TO_MTDSWAP(dev); | 1048 | struct mtdswap_dev *d = MTDSWAP_MBD_TO_MTDSWAP(dev); |
1049 | 1049 | ||
1050 | if (d->mtd->sync) | 1050 | mtd_sync(d->mtd); |
1051 | d->mtd->sync(d->mtd); | ||
1052 | return 0; | 1051 | return 0; |
1053 | } | 1052 | } |
1054 | 1053 | ||
@@ -1059,9 +1058,9 @@ static unsigned int mtdswap_badblocks(struct mtd_info *mtd, uint64_t size) | |||
1059 | 1058 | ||
1060 | badcnt = 0; | 1059 | badcnt = 0; |
1061 | 1060 | ||
1062 | if (mtd->block_isbad) | 1061 | if (mtd_can_have_bb(mtd)) |
1063 | for (offset = 0; offset < size; offset += mtd->erasesize) | 1062 | for (offset = 0; offset < size; offset += mtd->erasesize) |
1064 | if (mtd->block_isbad(mtd, offset)) | 1063 | if (mtd_block_isbad(mtd, offset)) |
1065 | badcnt++; | 1064 | badcnt++; |
1066 | 1065 | ||
1067 | return badcnt; | 1066 | return badcnt; |
@@ -1161,7 +1160,7 @@ static int mtdswap_readsect(struct mtd_blktrans_dev *dev, | |||
1161 | retries = 0; | 1160 | retries = 0; |
1162 | 1161 | ||
1163 | retry: | 1162 | retry: |
1164 | ret = mtd->read(mtd, readpos, PAGE_SIZE, &retlen, buf); | 1163 | ret = mtd_read(mtd, readpos, PAGE_SIZE, &retlen, buf); |
1165 | 1164 | ||
1166 | d->mtd_read_count++; | 1165 | d->mtd_read_count++; |
1167 | if (mtd_is_bitflip(ret)) { | 1166 | if (mtd_is_bitflip(ret)) { |