diff options
Diffstat (limited to 'drivers/mtd/ftl.c')
-rw-r--r-- | drivers/mtd/ftl.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 12fd7ebd3fd8..d591b1d0a6c1 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -422,8 +422,8 @@ static int prepare_xfer(partition_t *part, int i) | |||
422 | header.LogicalEUN = cpu_to_le16(0xffff); | 422 | header.LogicalEUN = cpu_to_le16(0xffff); |
423 | header.EraseCount = cpu_to_le32(xfer->EraseCount); | 423 | header.EraseCount = cpu_to_le32(xfer->EraseCount); |
424 | 424 | ||
425 | ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset, sizeof(header), | 425 | ret = mtd_write(part->mbd.mtd, xfer->Offset, sizeof(header), &retlen, |
426 | &retlen, (u_char *)&header); | 426 | (u_char *)&header); |
427 | 427 | ||
428 | if (ret) { | 428 | if (ret) { |
429 | return ret; | 429 | return ret; |
@@ -438,8 +438,8 @@ static int prepare_xfer(partition_t *part, int i) | |||
438 | 438 | ||
439 | for (i = 0; i < nbam; i++, offset += sizeof(uint32_t)) { | 439 | for (i = 0; i < nbam; i++, offset += sizeof(uint32_t)) { |
440 | 440 | ||
441 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint32_t), | 441 | ret = mtd_write(part->mbd.mtd, offset, sizeof(uint32_t), &retlen, |
442 | &retlen, (u_char *)&ctl); | 442 | (u_char *)&ctl); |
443 | 443 | ||
444 | if (ret) | 444 | if (ret) |
445 | return ret; | 445 | return ret; |
@@ -503,8 +503,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit, | |||
503 | offset = xfer->Offset + 20; /* Bad! */ | 503 | offset = xfer->Offset + 20; /* Bad! */ |
504 | unit = cpu_to_le16(0x7fff); | 504 | unit = cpu_to_le16(0x7fff); |
505 | 505 | ||
506 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint16_t), | 506 | ret = mtd_write(part->mbd.mtd, offset, sizeof(uint16_t), &retlen, |
507 | &retlen, (u_char *) &unit); | 507 | (u_char *)&unit); |
508 | 508 | ||
509 | if (ret) { | 509 | if (ret) { |
510 | printk( KERN_WARNING "ftl: Failed to write back to BAM cache in copy_erase_unit()!\n"); | 510 | printk( KERN_WARNING "ftl: Failed to write back to BAM cache in copy_erase_unit()!\n"); |
@@ -531,8 +531,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit, | |||
531 | } | 531 | } |
532 | 532 | ||
533 | 533 | ||
534 | ret = part->mbd.mtd->write(part->mbd.mtd, dest, SECTOR_SIZE, | 534 | ret = mtd_write(part->mbd.mtd, dest, SECTOR_SIZE, &retlen, |
535 | &retlen, (u_char *) buf); | 535 | (u_char *)buf); |
536 | if (ret) { | 536 | if (ret) { |
537 | printk(KERN_WARNING "ftl: Error writing new xfer unit in copy_erase_unit\n"); | 537 | printk(KERN_WARNING "ftl: Error writing new xfer unit in copy_erase_unit\n"); |
538 | return ret; | 538 | return ret; |
@@ -550,9 +550,11 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit, | |||
550 | } | 550 | } |
551 | 551 | ||
552 | /* Write the BAM to the transfer unit */ | 552 | /* Write the BAM to the transfer unit */ |
553 | ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + le32_to_cpu(part->header.BAMOffset), | 553 | ret = mtd_write(part->mbd.mtd, |
554 | part->BlocksPerUnit * sizeof(int32_t), &retlen, | 554 | xfer->Offset + le32_to_cpu(part->header.BAMOffset), |
555 | (u_char *)part->bam_cache); | 555 | part->BlocksPerUnit * sizeof(int32_t), |
556 | &retlen, | ||
557 | (u_char *)part->bam_cache); | ||
556 | if (ret) { | 558 | if (ret) { |
557 | printk( KERN_WARNING "ftl: Error writing BAM in copy_erase_unit\n"); | 559 | printk( KERN_WARNING "ftl: Error writing BAM in copy_erase_unit\n"); |
558 | return ret; | 560 | return ret; |
@@ -560,8 +562,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit, | |||
560 | 562 | ||
561 | 563 | ||
562 | /* All clear? Then update the LogicalEUN again */ | 564 | /* All clear? Then update the LogicalEUN again */ |
563 | ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + 20, sizeof(uint16_t), | 565 | ret = mtd_write(part->mbd.mtd, xfer->Offset + 20, sizeof(uint16_t), |
564 | &retlen, (u_char *)&srcunitswap); | 566 | &retlen, (u_char *)&srcunitswap); |
565 | 567 | ||
566 | if (ret) { | 568 | if (ret) { |
567 | printk(KERN_WARNING "ftl: Error writing new LogicalEUN in copy_erase_unit\n"); | 569 | printk(KERN_WARNING "ftl: Error writing new LogicalEUN in copy_erase_unit\n"); |
@@ -887,8 +889,8 @@ static int set_bam_entry(partition_t *part, uint32_t log_addr, | |||
887 | #endif | 889 | #endif |
888 | part->bam_cache[blk] = le_virt_addr; | 890 | part->bam_cache[blk] = le_virt_addr; |
889 | } | 891 | } |
890 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint32_t), | 892 | ret = mtd_write(part->mbd.mtd, offset, sizeof(uint32_t), &retlen, |
891 | &retlen, (u_char *)&le_virt_addr); | 893 | (u_char *)&le_virt_addr); |
892 | 894 | ||
893 | if (ret) { | 895 | if (ret) { |
894 | printk(KERN_NOTICE "ftl_cs: set_bam_entry() failed!\n"); | 896 | printk(KERN_NOTICE "ftl_cs: set_bam_entry() failed!\n"); |
@@ -947,8 +949,7 @@ static int ftl_write(partition_t *part, caddr_t buffer, | |||
947 | part->EUNInfo[part->bam_index].Deleted++; | 949 | part->EUNInfo[part->bam_index].Deleted++; |
948 | offset = (part->EUNInfo[part->bam_index].Offset + | 950 | offset = (part->EUNInfo[part->bam_index].Offset + |
949 | blk * SECTOR_SIZE); | 951 | blk * SECTOR_SIZE); |
950 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, SECTOR_SIZE, &retlen, | 952 | ret = mtd_write(part->mbd.mtd, offset, SECTOR_SIZE, &retlen, buffer); |
951 | buffer); | ||
952 | 953 | ||
953 | if (ret) { | 954 | if (ret) { |
954 | printk(KERN_NOTICE "ftl_cs: block write failed!\n"); | 955 | printk(KERN_NOTICE "ftl_cs: block write failed!\n"); |