diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2008-12-10 09:06:42 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-12-10 09:06:42 -0500 |
commit | 3854be7712f7b4bdcaed14664fc7c7124b3fef0d (patch) | |
tree | d1003e77963a424ac13841e69ae1e03f0ea5db2b /drivers/mtd | |
parent | 0f07a0be39735651091418c09b257785d12fbc59 (diff) |
[MTD] Remove strange u_int32_t types from FTL
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ftl.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 9bf581c4f740..a790c062af1f 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -109,25 +109,25 @@ module_param(shuffle_freq, int, 0); | |||
109 | /* Each memory region corresponds to a minor device */ | 109 | /* Each memory region corresponds to a minor device */ |
110 | typedef struct partition_t { | 110 | typedef struct partition_t { |
111 | struct mtd_blktrans_dev mbd; | 111 | struct mtd_blktrans_dev mbd; |
112 | u_int32_t state; | 112 | uint32_t state; |
113 | u_int32_t *VirtualBlockMap; | 113 | uint32_t *VirtualBlockMap; |
114 | u_int32_t *VirtualPageMap; | 114 | uint32_t *VirtualPageMap; |
115 | u_int32_t FreeTotal; | 115 | uint32_t FreeTotal; |
116 | struct eun_info_t { | 116 | struct eun_info_t { |
117 | u_int32_t Offset; | 117 | uint32_t Offset; |
118 | u_int32_t EraseCount; | 118 | uint32_t EraseCount; |
119 | u_int32_t Free; | 119 | uint32_t Free; |
120 | u_int32_t Deleted; | 120 | uint32_t Deleted; |
121 | } *EUNInfo; | 121 | } *EUNInfo; |
122 | struct xfer_info_t { | 122 | struct xfer_info_t { |
123 | u_int32_t Offset; | 123 | uint32_t Offset; |
124 | u_int32_t EraseCount; | 124 | uint32_t EraseCount; |
125 | u_int16_t state; | 125 | uint16_t state; |
126 | } *XferInfo; | 126 | } *XferInfo; |
127 | u_int16_t bam_index; | 127 | uint16_t bam_index; |
128 | u_int32_t *bam_cache; | 128 | uint32_t *bam_cache; |
129 | u_int16_t DataUnits; | 129 | uint16_t DataUnits; |
130 | u_int32_t BlocksPerUnit; | 130 | uint32_t BlocksPerUnit; |
131 | erase_unit_header_t header; | 131 | erase_unit_header_t header; |
132 | } partition_t; | 132 | } partition_t; |
133 | 133 | ||
@@ -199,8 +199,8 @@ static int scan_header(partition_t *part) | |||
199 | static int build_maps(partition_t *part) | 199 | static int build_maps(partition_t *part) |
200 | { | 200 | { |
201 | erase_unit_header_t header; | 201 | erase_unit_header_t header; |
202 | u_int16_t xvalid, xtrans, i; | 202 | uint16_t xvalid, xtrans, i; |
203 | u_int blocks, j; | 203 | unsigned blocks, j; |
204 | int hdr_ok, ret = -1; | 204 | int hdr_ok, ret = -1; |
205 | ssize_t retval; | 205 | ssize_t retval; |
206 | loff_t offset; | 206 | loff_t offset; |
@@ -269,14 +269,14 @@ static int build_maps(partition_t *part) | |||
269 | 269 | ||
270 | /* Set up virtual page map */ | 270 | /* Set up virtual page map */ |
271 | blocks = le32_to_cpu(header.FormattedSize) >> header.BlockSize; | 271 | blocks = le32_to_cpu(header.FormattedSize) >> header.BlockSize; |
272 | part->VirtualBlockMap = vmalloc(blocks * sizeof(u_int32_t)); | 272 | part->VirtualBlockMap = vmalloc(blocks * sizeof(uint32_t)); |
273 | if (!part->VirtualBlockMap) | 273 | if (!part->VirtualBlockMap) |
274 | goto out_XferInfo; | 274 | goto out_XferInfo; |
275 | 275 | ||
276 | memset(part->VirtualBlockMap, 0xff, blocks * sizeof(u_int32_t)); | 276 | memset(part->VirtualBlockMap, 0xff, blocks * sizeof(uint32_t)); |
277 | part->BlocksPerUnit = (1 << header.EraseUnitSize) >> header.BlockSize; | 277 | part->BlocksPerUnit = (1 << header.EraseUnitSize) >> header.BlockSize; |
278 | 278 | ||
279 | part->bam_cache = kmalloc(part->BlocksPerUnit * sizeof(u_int32_t), | 279 | part->bam_cache = kmalloc(part->BlocksPerUnit * sizeof(uint32_t), |
280 | GFP_KERNEL); | 280 | GFP_KERNEL); |
281 | if (!part->bam_cache) | 281 | if (!part->bam_cache) |
282 | goto out_VirtualBlockMap; | 282 | goto out_VirtualBlockMap; |
@@ -290,7 +290,7 @@ static int build_maps(partition_t *part) | |||
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 = part->mbd.mtd->read(part->mbd.mtd, offset, |
293 | part->BlocksPerUnit * sizeof(u_int32_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) |
@@ -332,7 +332,7 @@ out: | |||
332 | ======================================================================*/ | 332 | ======================================================================*/ |
333 | 333 | ||
334 | static int erase_xfer(partition_t *part, | 334 | static int erase_xfer(partition_t *part, |
335 | u_int16_t xfernum) | 335 | uint16_t xfernum) |
336 | { | 336 | { |
337 | int ret; | 337 | int ret; |
338 | struct xfer_info_t *xfer; | 338 | struct xfer_info_t *xfer; |
@@ -408,7 +408,7 @@ static int prepare_xfer(partition_t *part, int i) | |||
408 | erase_unit_header_t header; | 408 | erase_unit_header_t header; |
409 | struct xfer_info_t *xfer; | 409 | struct xfer_info_t *xfer; |
410 | int nbam, ret; | 410 | int nbam, ret; |
411 | u_int32_t ctl; | 411 | uint32_t ctl; |
412 | ssize_t retlen; | 412 | ssize_t retlen; |
413 | loff_t offset; | 413 | loff_t offset; |
414 | 414 | ||
@@ -430,15 +430,15 @@ static int prepare_xfer(partition_t *part, int i) | |||
430 | } | 430 | } |
431 | 431 | ||
432 | /* Write the BAM stub */ | 432 | /* Write the BAM stub */ |
433 | nbam = (part->BlocksPerUnit * sizeof(u_int32_t) + | 433 | nbam = (part->BlocksPerUnit * sizeof(uint32_t) + |
434 | le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / SECTOR_SIZE; | 434 | le32_to_cpu(part->header.BAMOffset) + SECTOR_SIZE - 1) / SECTOR_SIZE; |
435 | 435 | ||
436 | offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset); | 436 | offset = xfer->Offset + le32_to_cpu(part->header.BAMOffset); |
437 | ctl = cpu_to_le32(BLOCK_CONTROL); | 437 | ctl = cpu_to_le32(BLOCK_CONTROL); |
438 | 438 | ||
439 | for (i = 0; i < nbam; i++, offset += sizeof(u_int32_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(u_int32_t), | 441 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint32_t), |
442 | &retlen, (u_char *)&ctl); | 442 | &retlen, (u_char *)&ctl); |
443 | 443 | ||
444 | if (ret) | 444 | if (ret) |
@@ -461,18 +461,18 @@ static int prepare_xfer(partition_t *part, int i) | |||
461 | 461 | ||
462 | ======================================================================*/ | 462 | ======================================================================*/ |
463 | 463 | ||
464 | static int copy_erase_unit(partition_t *part, u_int16_t srcunit, | 464 | static int copy_erase_unit(partition_t *part, uint16_t srcunit, |
465 | u_int16_t xferunit) | 465 | uint16_t xferunit) |
466 | { | 466 | { |
467 | u_char buf[SECTOR_SIZE]; | 467 | u_char buf[SECTOR_SIZE]; |
468 | struct eun_info_t *eun; | 468 | struct eun_info_t *eun; |
469 | struct xfer_info_t *xfer; | 469 | struct xfer_info_t *xfer; |
470 | u_int32_t src, dest, free, i; | 470 | uint32_t src, dest, free, i; |
471 | u_int16_t unit; | 471 | uint16_t unit; |
472 | int ret; | 472 | int ret; |
473 | ssize_t retlen; | 473 | ssize_t retlen; |
474 | loff_t offset; | 474 | loff_t offset; |
475 | u_int16_t srcunitswap = cpu_to_le16(srcunit); | 475 | uint16_t srcunitswap = cpu_to_le16(srcunit); |
476 | 476 | ||
477 | eun = &part->EUNInfo[srcunit]; | 477 | eun = &part->EUNInfo[srcunit]; |
478 | xfer = &part->XferInfo[xferunit]; | 478 | xfer = &part->XferInfo[xferunit]; |
@@ -486,7 +486,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit, | |||
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 = part->mbd.mtd->read(part->mbd.mtd, offset, |
489 | part->BlocksPerUnit * sizeof(u_int32_t), | 489 | part->BlocksPerUnit * sizeof(uint32_t), |
490 | &retlen, (u_char *) (part->bam_cache)); | 490 | &retlen, (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 */ |
@@ -503,7 +503,7 @@ static int copy_erase_unit(partition_t *part, u_int16_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(u_int16_t), | 506 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint16_t), |
507 | &retlen, (u_char *) &unit); | 507 | &retlen, (u_char *) &unit); |
508 | 508 | ||
509 | if (ret) { | 509 | if (ret) { |
@@ -560,7 +560,7 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit, | |||
560 | 560 | ||
561 | 561 | ||
562 | /* All clear? Then update the LogicalEUN again */ | 562 | /* All clear? Then update the LogicalEUN again */ |
563 | ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + 20, sizeof(u_int16_t), | 563 | ret = part->mbd.mtd->write(part->mbd.mtd, xfer->Offset + 20, sizeof(uint16_t), |
564 | &retlen, (u_char *)&srcunitswap); | 564 | &retlen, (u_char *)&srcunitswap); |
565 | 565 | ||
566 | if (ret) { | 566 | if (ret) { |
@@ -605,8 +605,8 @@ static int copy_erase_unit(partition_t *part, u_int16_t srcunit, | |||
605 | 605 | ||
606 | static int reclaim_block(partition_t *part) | 606 | static int reclaim_block(partition_t *part) |
607 | { | 607 | { |
608 | u_int16_t i, eun, xfer; | 608 | uint16_t i, eun, xfer; |
609 | u_int32_t best; | 609 | uint32_t best; |
610 | int queued, ret; | 610 | int queued, ret; |
611 | 611 | ||
612 | DEBUG(0, "ftl_cs: reclaiming space...\n"); | 612 | DEBUG(0, "ftl_cs: reclaiming space...\n"); |
@@ -723,10 +723,10 @@ static void dump_lists(partition_t *part) | |||
723 | } | 723 | } |
724 | #endif | 724 | #endif |
725 | 725 | ||
726 | static u_int32_t find_free(partition_t *part) | 726 | static uint32_t find_free(partition_t *part) |
727 | { | 727 | { |
728 | u_int16_t stop, eun; | 728 | uint16_t stop, eun; |
729 | u_int32_t blk; | 729 | uint32_t blk; |
730 | size_t retlen; | 730 | size_t retlen; |
731 | int ret; | 731 | int ret; |
732 | 732 | ||
@@ -749,7 +749,7 @@ static u_int32_t find_free(partition_t *part) | |||
749 | 749 | ||
750 | ret = part->mbd.mtd->read(part->mbd.mtd, | 750 | ret = part->mbd.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(u_int32_t), | 752 | part->BlocksPerUnit * sizeof(uint32_t), |
753 | &retlen, (u_char *) (part->bam_cache)); | 753 | &retlen, (u_char *) (part->bam_cache)); |
754 | 754 | ||
755 | if (ret) { | 755 | if (ret) { |
@@ -786,7 +786,7 @@ static u_int32_t find_free(partition_t *part) | |||
786 | static int ftl_read(partition_t *part, caddr_t buffer, | 786 | static int ftl_read(partition_t *part, caddr_t buffer, |
787 | u_long sector, u_long nblocks) | 787 | u_long sector, u_long nblocks) |
788 | { | 788 | { |
789 | u_int32_t log_addr, bsize; | 789 | uint32_t log_addr, bsize; |
790 | u_long i; | 790 | u_long i; |
791 | int ret; | 791 | int ret; |
792 | size_t offset, retlen; | 792 | size_t offset, retlen; |
@@ -829,14 +829,14 @@ static int ftl_read(partition_t *part, caddr_t buffer, | |||
829 | 829 | ||
830 | ======================================================================*/ | 830 | ======================================================================*/ |
831 | 831 | ||
832 | static int set_bam_entry(partition_t *part, u_int32_t log_addr, | 832 | static int set_bam_entry(partition_t *part, uint32_t log_addr, |
833 | u_int32_t virt_addr) | 833 | uint32_t virt_addr) |
834 | { | 834 | { |
835 | u_int32_t bsize, blk, le_virt_addr; | 835 | uint32_t bsize, blk, le_virt_addr; |
836 | #ifdef PSYCHO_DEBUG | 836 | #ifdef PSYCHO_DEBUG |
837 | u_int32_t old_addr; | 837 | uint32_t old_addr; |
838 | #endif | 838 | #endif |
839 | u_int16_t eun; | 839 | uint16_t eun; |
840 | int ret; | 840 | int ret; |
841 | size_t retlen, offset; | 841 | size_t retlen, offset; |
842 | 842 | ||
@@ -845,11 +845,11 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr, | |||
845 | bsize = 1 << part->header.EraseUnitSize; | 845 | bsize = 1 << part->header.EraseUnitSize; |
846 | eun = log_addr / bsize; | 846 | eun = log_addr / bsize; |
847 | blk = (log_addr % bsize) / SECTOR_SIZE; | 847 | blk = (log_addr % bsize) / SECTOR_SIZE; |
848 | offset = (part->EUNInfo[eun].Offset + blk * sizeof(u_int32_t) + | 848 | offset = (part->EUNInfo[eun].Offset + blk * sizeof(uint32_t) + |
849 | le32_to_cpu(part->header.BAMOffset)); | 849 | le32_to_cpu(part->header.BAMOffset)); |
850 | 850 | ||
851 | #ifdef PSYCHO_DEBUG | 851 | #ifdef PSYCHO_DEBUG |
852 | ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(u_int32_t), | 852 | ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(uint32_t), |
853 | &retlen, (u_char *)&old_addr); | 853 | &retlen, (u_char *)&old_addr); |
854 | if (ret) { | 854 | if (ret) { |
855 | printk(KERN_WARNING"ftl: Error reading old_addr in set_bam_entry: %d\n",ret); | 855 | printk(KERN_WARNING"ftl: Error reading old_addr in set_bam_entry: %d\n",ret); |
@@ -886,7 +886,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr, | |||
886 | #endif | 886 | #endif |
887 | part->bam_cache[blk] = le_virt_addr; | 887 | part->bam_cache[blk] = le_virt_addr; |
888 | } | 888 | } |
889 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(u_int32_t), | 889 | ret = part->mbd.mtd->write(part->mbd.mtd, offset, sizeof(uint32_t), |
890 | &retlen, (u_char *)&le_virt_addr); | 890 | &retlen, (u_char *)&le_virt_addr); |
891 | 891 | ||
892 | if (ret) { | 892 | if (ret) { |
@@ -900,7 +900,7 @@ static int set_bam_entry(partition_t *part, u_int32_t log_addr, | |||
900 | static int ftl_write(partition_t *part, caddr_t buffer, | 900 | static int ftl_write(partition_t *part, caddr_t buffer, |
901 | u_long sector, u_long nblocks) | 901 | u_long sector, u_long nblocks) |
902 | { | 902 | { |
903 | u_int32_t bsize, log_addr, virt_addr, old_addr, blk; | 903 | uint32_t bsize, log_addr, virt_addr, old_addr, blk; |
904 | u_long i; | 904 | u_long i; |
905 | int ret; | 905 | int ret; |
906 | size_t retlen, offset; | 906 | size_t retlen, offset; |