diff options
Diffstat (limited to 'drivers/mtd/ftl.c')
-rw-r--r-- | drivers/mtd/ftl.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index a982889277c8..12fd7ebd3fd8 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -168,8 +168,8 @@ static int scan_header(partition_t *part) | |||
168 | (offset + sizeof(header)) < max_offset; | 168 | (offset + sizeof(header)) < max_offset; |
169 | offset += part->mbd.mtd->erasesize ? : 0x2000) { | 169 | offset += part->mbd.mtd->erasesize ? : 0x2000) { |
170 | 170 | ||
171 | err = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &ret, | 171 | err = mtd_read(part->mbd.mtd, offset, sizeof(header), &ret, |
172 | (unsigned char *)&header); | 172 | (unsigned char *)&header); |
173 | 173 | ||
174 | if (err) | 174 | if (err) |
175 | return err; | 175 | return err; |
@@ -224,8 +224,8 @@ static int build_maps(partition_t *part) | |||
224 | for (i = 0; i < le16_to_cpu(part->header.NumEraseUnits); i++) { | 224 | for (i = 0; i < le16_to_cpu(part->header.NumEraseUnits); i++) { |
225 | offset = ((i + le16_to_cpu(part->header.FirstPhysicalEUN)) | 225 | offset = ((i + le16_to_cpu(part->header.FirstPhysicalEUN)) |
226 | << part->header.EraseUnitSize); | 226 | << part->header.EraseUnitSize); |
227 | ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &retval, | 227 | ret = mtd_read(part->mbd.mtd, offset, sizeof(header), &retval, |
228 | (unsigned char *)&header); | 228 | (unsigned char *)&header); |
229 | 229 | ||
230 | if (ret) | 230 | if (ret) |
231 | goto out_XferInfo; | 231 | goto out_XferInfo; |
@@ -289,9 +289,9 @@ static int build_maps(partition_t *part) | |||
289 | part->EUNInfo[i].Deleted = 0; | 289 | part->EUNInfo[i].Deleted = 0; |
290 | offset = part->EUNInfo[i].Offset + le32_to_cpu(header.BAMOffset); | 290 | offset = part->EUNInfo[i].Offset + le32_to_cpu(header.BAMOffset); |
291 | 291 | ||
292 | ret = part->mbd.mtd->read(part->mbd.mtd, offset, | 292 | ret = mtd_read(part->mbd.mtd, offset, |
293 | part->BlocksPerUnit * sizeof(uint32_t), &retval, | 293 | part->BlocksPerUnit * sizeof(uint32_t), &retval, |
294 | (unsigned char *)part->bam_cache); | 294 | (unsigned char *)part->bam_cache); |
295 | 295 | ||
296 | if (ret) | 296 | if (ret) |
297 | goto out_bam_cache; | 297 | goto out_bam_cache; |
@@ -485,9 +485,9 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit, | |||
485 | 485 | ||
486 | offset = eun->Offset + le32_to_cpu(part->header.BAMOffset); | 486 | offset = eun->Offset + le32_to_cpu(part->header.BAMOffset); |
487 | 487 | ||
488 | ret = part->mbd.mtd->read(part->mbd.mtd, offset, | 488 | ret = mtd_read(part->mbd.mtd, offset, |
489 | part->BlocksPerUnit * sizeof(uint32_t), | 489 | part->BlocksPerUnit * sizeof(uint32_t), &retlen, |
490 | &retlen, (u_char *) (part->bam_cache)); | 490 | (u_char *)(part->bam_cache)); |
491 | 491 | ||
492 | /* mark the cache bad, in case we get an error later */ | 492 | /* mark the cache bad, in case we get an error later */ |
493 | part->bam_index = 0xffff; | 493 | part->bam_index = 0xffff; |
@@ -523,8 +523,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit, | |||
523 | break; | 523 | break; |
524 | case BLOCK_DATA: | 524 | case BLOCK_DATA: |
525 | case BLOCK_REPLACEMENT: | 525 | case BLOCK_REPLACEMENT: |
526 | ret = part->mbd.mtd->read(part->mbd.mtd, src, SECTOR_SIZE, | 526 | ret = mtd_read(part->mbd.mtd, src, SECTOR_SIZE, &retlen, |
527 | &retlen, (u_char *) buf); | 527 | (u_char *)buf); |
528 | if (ret) { | 528 | if (ret) { |
529 | printk(KERN_WARNING "ftl: Error reading old xfer unit in copy_erase_unit\n"); | 529 | printk(KERN_WARNING "ftl: Error reading old xfer unit in copy_erase_unit\n"); |
530 | return ret; | 530 | return ret; |
@@ -747,10 +747,11 @@ static uint32_t find_free(partition_t *part) | |||
747 | /* Invalidate cache */ | 747 | /* Invalidate cache */ |
748 | part->bam_index = 0xffff; | 748 | part->bam_index = 0xffff; |
749 | 749 | ||
750 | ret = part->mbd.mtd->read(part->mbd.mtd, | 750 | ret = mtd_read(part->mbd.mtd, |
751 | part->EUNInfo[eun].Offset + le32_to_cpu(part->header.BAMOffset), | 751 | part->EUNInfo[eun].Offset + le32_to_cpu(part->header.BAMOffset), |
752 | part->BlocksPerUnit * sizeof(uint32_t), | 752 | part->BlocksPerUnit * sizeof(uint32_t), |
753 | &retlen, (u_char *) (part->bam_cache)); | 753 | &retlen, |
754 | (u_char *)(part->bam_cache)); | ||
754 | 755 | ||
755 | if (ret) { | 756 | if (ret) { |
756 | printk(KERN_WARNING"ftl: Error reading BAM in find_free\n"); | 757 | printk(KERN_WARNING"ftl: Error reading BAM in find_free\n"); |
@@ -810,8 +811,8 @@ static int ftl_read(partition_t *part, caddr_t buffer, | |||
810 | else { | 811 | else { |
811 | offset = (part->EUNInfo[log_addr / bsize].Offset | 812 | offset = (part->EUNInfo[log_addr / bsize].Offset |
812 | + (log_addr % bsize)); | 813 | + (log_addr % bsize)); |
813 | ret = part->mbd.mtd->read(part->mbd.mtd, offset, SECTOR_SIZE, | 814 | ret = mtd_read(part->mbd.mtd, offset, SECTOR_SIZE, &retlen, |
814 | &retlen, (u_char *) buffer); | 815 | (u_char *)buffer); |
815 | 816 | ||
816 | if (ret) { | 817 | if (ret) { |
817 | printk(KERN_WARNING "Error reading MTD device in ftl_read()\n"); | 818 | printk(KERN_WARNING "Error reading MTD device in ftl_read()\n"); |
@@ -849,8 +850,8 @@ static int set_bam_entry(partition_t *part, uint32_t log_addr, | |||
849 | le32_to_cpu(part->header.BAMOffset)); | 850 | le32_to_cpu(part->header.BAMOffset)); |
850 | 851 | ||
851 | #ifdef PSYCHO_DEBUG | 852 | #ifdef PSYCHO_DEBUG |
852 | ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(uint32_t), | 853 | ret = mtd_read(part->mbd.mtd, offset, sizeof(uint32_t), &retlen, |
853 | &retlen, (u_char *)&old_addr); | 854 | (u_char *)&old_addr); |
854 | if (ret) { | 855 | if (ret) { |
855 | printk(KERN_WARNING"ftl: Error reading old_addr in set_bam_entry: %d\n",ret); | 856 | printk(KERN_WARNING"ftl: Error reading old_addr in set_bam_entry: %d\n",ret); |
856 | return ret; | 857 | return ret; |