diff options
Diffstat (limited to 'drivers/mtd/mtdconcat.c')
-rw-r--r-- | drivers/mtd/mtdconcat.c | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 6df4d4d4eb92..1ed5103b219b 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -91,7 +91,7 @@ concat_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
91 | /* Entire transaction goes into this subdev */ | 91 | /* Entire transaction goes into this subdev */ |
92 | size = len; | 92 | size = len; |
93 | 93 | ||
94 | err = subdev->read(subdev, from, size, &retsize, buf); | 94 | err = mtd_read(subdev, from, size, &retsize, buf); |
95 | 95 | ||
96 | /* Save information about bitflips! */ | 96 | /* Save information about bitflips! */ |
97 | if (unlikely(err)) { | 97 | if (unlikely(err)) { |
@@ -148,7 +148,7 @@ concat_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
148 | if (!(subdev->flags & MTD_WRITEABLE)) | 148 | if (!(subdev->flags & MTD_WRITEABLE)) |
149 | err = -EROFS; | 149 | err = -EROFS; |
150 | else | 150 | else |
151 | err = subdev->write(subdev, to, size, &retsize, buf); | 151 | err = mtd_write(subdev, to, size, &retsize, buf); |
152 | 152 | ||
153 | if (err) | 153 | if (err) |
154 | break; | 154 | break; |
@@ -227,8 +227,9 @@ concat_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
227 | if (!(subdev->flags & MTD_WRITEABLE)) | 227 | if (!(subdev->flags & MTD_WRITEABLE)) |
228 | err = -EROFS; | 228 | err = -EROFS; |
229 | else | 229 | else |
230 | err = subdev->writev(subdev, &vecs_copy[entry_low], | 230 | err = mtd_writev(subdev, &vecs_copy[entry_low], |
231 | entry_high - entry_low + 1, to, &retsize); | 231 | entry_high - entry_low + 1, to, |
232 | &retsize); | ||
232 | 233 | ||
233 | vecs_copy[entry_high].iov_len = old_iov_len - size; | 234 | vecs_copy[entry_high].iov_len = old_iov_len - size; |
234 | vecs_copy[entry_high].iov_base += size; | 235 | vecs_copy[entry_high].iov_base += size; |
@@ -273,7 +274,7 @@ concat_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) | |||
273 | if (from + devops.len > subdev->size) | 274 | if (from + devops.len > subdev->size) |
274 | devops.len = subdev->size - from; | 275 | devops.len = subdev->size - from; |
275 | 276 | ||
276 | err = subdev->read_oob(subdev, from, &devops); | 277 | err = mtd_read_oob(subdev, from, &devops); |
277 | ops->retlen += devops.retlen; | 278 | ops->retlen += devops.retlen; |
278 | ops->oobretlen += devops.oobretlen; | 279 | ops->oobretlen += devops.oobretlen; |
279 | 280 | ||
@@ -333,7 +334,7 @@ concat_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops) | |||
333 | if (to + devops.len > subdev->size) | 334 | if (to + devops.len > subdev->size) |
334 | devops.len = subdev->size - to; | 335 | devops.len = subdev->size - to; |
335 | 336 | ||
336 | err = subdev->write_oob(subdev, to, &devops); | 337 | err = mtd_write_oob(subdev, to, &devops); |
337 | ops->retlen += devops.oobretlen; | 338 | ops->retlen += devops.oobretlen; |
338 | if (err) | 339 | if (err) |
339 | return err; | 340 | return err; |
@@ -379,7 +380,7 @@ static int concat_dev_erase(struct mtd_info *mtd, struct erase_info *erase) | |||
379 | * FIXME: Allow INTERRUPTIBLE. Which means | 380 | * FIXME: Allow INTERRUPTIBLE. Which means |
380 | * not having the wait_queue head on the stack. | 381 | * not having the wait_queue head on the stack. |
381 | */ | 382 | */ |
382 | err = mtd->erase(mtd, erase); | 383 | err = mtd_erase(mtd, erase); |
383 | if (!err) { | 384 | if (!err) { |
384 | set_current_state(TASK_UNINTERRUPTIBLE); | 385 | set_current_state(TASK_UNINTERRUPTIBLE); |
385 | add_wait_queue(&waitq, &wait); | 386 | add_wait_queue(&waitq, &wait); |
@@ -554,12 +555,9 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
554 | else | 555 | else |
555 | size = len; | 556 | size = len; |
556 | 557 | ||
557 | if (subdev->lock) { | 558 | err = mtd_lock(subdev, ofs, size); |
558 | err = subdev->lock(subdev, ofs, size); | 559 | if (err) |
559 | if (err) | 560 | break; |
560 | break; | ||
561 | } else | ||
562 | err = -EOPNOTSUPP; | ||
563 | 561 | ||
564 | len -= size; | 562 | len -= size; |
565 | if (len == 0) | 563 | if (len == 0) |
@@ -594,12 +592,9 @@ static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
594 | else | 592 | else |
595 | size = len; | 593 | size = len; |
596 | 594 | ||
597 | if (subdev->unlock) { | 595 | err = mtd_unlock(subdev, ofs, size); |
598 | err = subdev->unlock(subdev, ofs, size); | 596 | if (err) |
599 | if (err) | 597 | break; |
600 | break; | ||
601 | } else | ||
602 | err = -EOPNOTSUPP; | ||
603 | 598 | ||
604 | len -= size; | 599 | len -= size; |
605 | if (len == 0) | 600 | if (len == 0) |
@@ -619,7 +614,7 @@ static void concat_sync(struct mtd_info *mtd) | |||
619 | 614 | ||
620 | for (i = 0; i < concat->num_subdev; i++) { | 615 | for (i = 0; i < concat->num_subdev; i++) { |
621 | struct mtd_info *subdev = concat->subdev[i]; | 616 | struct mtd_info *subdev = concat->subdev[i]; |
622 | subdev->sync(subdev); | 617 | mtd_sync(subdev); |
623 | } | 618 | } |
624 | } | 619 | } |
625 | 620 | ||
@@ -630,7 +625,7 @@ static int concat_suspend(struct mtd_info *mtd) | |||
630 | 625 | ||
631 | for (i = 0; i < concat->num_subdev; i++) { | 626 | for (i = 0; i < concat->num_subdev; i++) { |
632 | struct mtd_info *subdev = concat->subdev[i]; | 627 | struct mtd_info *subdev = concat->subdev[i]; |
633 | if ((rc = subdev->suspend(subdev)) < 0) | 628 | if ((rc = mtd_suspend(subdev)) < 0) |
634 | return rc; | 629 | return rc; |
635 | } | 630 | } |
636 | return rc; | 631 | return rc; |
@@ -643,7 +638,7 @@ static void concat_resume(struct mtd_info *mtd) | |||
643 | 638 | ||
644 | for (i = 0; i < concat->num_subdev; i++) { | 639 | for (i = 0; i < concat->num_subdev; i++) { |
645 | struct mtd_info *subdev = concat->subdev[i]; | 640 | struct mtd_info *subdev = concat->subdev[i]; |
646 | subdev->resume(subdev); | 641 | mtd_resume(subdev); |
647 | } | 642 | } |
648 | } | 643 | } |
649 | 644 | ||
@@ -652,7 +647,7 @@ static int concat_block_isbad(struct mtd_info *mtd, loff_t ofs) | |||
652 | struct mtd_concat *concat = CONCAT(mtd); | 647 | struct mtd_concat *concat = CONCAT(mtd); |
653 | int i, res = 0; | 648 | int i, res = 0; |
654 | 649 | ||
655 | if (!concat->subdev[0]->block_isbad) | 650 | if (!mtd_can_have_bb(concat->subdev[0])) |
656 | return res; | 651 | return res; |
657 | 652 | ||
658 | if (ofs > mtd->size) | 653 | if (ofs > mtd->size) |
@@ -666,7 +661,7 @@ static int concat_block_isbad(struct mtd_info *mtd, loff_t ofs) | |||
666 | continue; | 661 | continue; |
667 | } | 662 | } |
668 | 663 | ||
669 | res = subdev->block_isbad(subdev, ofs); | 664 | res = mtd_block_isbad(subdev, ofs); |
670 | break; | 665 | break; |
671 | } | 666 | } |
672 | 667 | ||
@@ -678,7 +673,7 @@ static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
678 | struct mtd_concat *concat = CONCAT(mtd); | 673 | struct mtd_concat *concat = CONCAT(mtd); |
679 | int i, err = -EINVAL; | 674 | int i, err = -EINVAL; |
680 | 675 | ||
681 | if (!concat->subdev[0]->block_markbad) | 676 | if (!mtd_can_have_bb(concat->subdev[0])) |
682 | return 0; | 677 | return 0; |
683 | 678 | ||
684 | if (ofs > mtd->size) | 679 | if (ofs > mtd->size) |
@@ -692,7 +687,7 @@ static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
692 | continue; | 687 | continue; |
693 | } | 688 | } |
694 | 689 | ||
695 | err = subdev->block_markbad(subdev, ofs); | 690 | err = mtd_block_markbad(subdev, ofs); |
696 | if (!err) | 691 | if (!err) |
697 | mtd->ecc_stats.badblocks++; | 692 | mtd->ecc_stats.badblocks++; |
698 | break; | 693 | break; |
@@ -725,11 +720,7 @@ static unsigned long concat_get_unmapped_area(struct mtd_info *mtd, | |||
725 | if (offset + len > subdev->size) | 720 | if (offset + len > subdev->size) |
726 | return (unsigned long) -EINVAL; | 721 | return (unsigned long) -EINVAL; |
727 | 722 | ||
728 | if (subdev->get_unmapped_area) | 723 | return mtd_get_unmapped_area(subdev, len, offset, flags); |
729 | return subdev->get_unmapped_area(subdev, len, offset, | ||
730 | flags); | ||
731 | |||
732 | break; | ||
733 | } | 724 | } |
734 | 725 | ||
735 | return (unsigned long) -ENOSYS; | 726 | return (unsigned long) -ENOSYS; |