diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 12 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 8 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0020.c | 14 | ||||
-rw-r--r-- | drivers/mtd/chips/fwh_lock.h | 4 | ||||
-rw-r--r-- | drivers/mtd/inftlcore.c | 2 | ||||
-rw-r--r-- | drivers/mtd/inftlmount.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/amd76xrom.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/ck804xrom.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/esb2rom.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/ichxrom.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/nettel.c | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/scb2_flash.c | 8 | ||||
-rw-r--r-- | drivers/mtd/mtdchar.c | 6 | ||||
-rw-r--r-- | drivers/mtd/mtdconcat.c | 33 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.c | 16 | ||||
-rw-r--r-- | drivers/mtd/mtdoops.c | 9 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 34 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 24 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 31 | ||||
-rw-r--r-- | drivers/mtd/nftlcore.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nftlmount.c | 4 | ||||
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 8 | ||||
-rw-r--r-- | drivers/mtd/rfd_ftl.c | 23 | ||||
-rw-r--r-- | drivers/mtd/ssfdc.c | 7 | ||||
-rw-r--r-- | drivers/mtd/ubi/build.c | 2 | ||||
-rw-r--r-- | drivers/mtd/ubi/gluebi.c | 17 |
26 files changed, 161 insertions, 125 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index c93a8be5d5f1..f5ab6fa1057b 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -58,8 +58,8 @@ static int cfi_intelext_write_buffers(struct mtd_info *, loff_t, size_t, size_t | |||
58 | static int cfi_intelext_writev(struct mtd_info *, const struct kvec *, unsigned long, loff_t, size_t *); | 58 | static int cfi_intelext_writev(struct mtd_info *, const struct kvec *, unsigned long, loff_t, size_t *); |
59 | static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *); | 59 | static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *); |
60 | static void cfi_intelext_sync (struct mtd_info *); | 60 | static void cfi_intelext_sync (struct mtd_info *); |
61 | static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len); | 61 | static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
62 | static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len); | 62 | static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
63 | #ifdef CONFIG_MTD_OTP | 63 | #ifdef CONFIG_MTD_OTP |
64 | static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 64 | static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
65 | static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 65 | static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
@@ -558,8 +558,8 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd) | |||
558 | } | 558 | } |
559 | 559 | ||
560 | for (i=0; i<mtd->numeraseregions;i++){ | 560 | for (i=0; i<mtd->numeraseregions;i++){ |
561 | printk(KERN_DEBUG "erase region %d: offset=0x%x,size=0x%x,blocks=%d\n", | 561 | printk(KERN_DEBUG "erase region %d: offset=0x%llx,size=0x%x,blocks=%d\n", |
562 | i,mtd->eraseregions[i].offset, | 562 | i,(unsigned long long)mtd->eraseregions[i].offset, |
563 | mtd->eraseregions[i].erasesize, | 563 | mtd->eraseregions[i].erasesize, |
564 | mtd->eraseregions[i].numblocks); | 564 | mtd->eraseregions[i].numblocks); |
565 | } | 565 | } |
@@ -2058,7 +2058,7 @@ out: put_chip(map, chip, adr); | |||
2058 | return ret; | 2058 | return ret; |
2059 | } | 2059 | } |
2060 | 2060 | ||
2061 | static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | 2061 | static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
2062 | { | 2062 | { |
2063 | int ret; | 2063 | int ret; |
2064 | 2064 | ||
@@ -2082,7 +2082,7 @@ static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | |||
2082 | return ret; | 2082 | return ret; |
2083 | } | 2083 | } |
2084 | 2084 | ||
2085 | static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) | 2085 | static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
2086 | { | 2086 | { |
2087 | int ret; | 2087 | int ret; |
2088 | 2088 | ||
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index d74ec46aa032..f9c435a42670 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -71,8 +71,8 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
71 | static void put_chip(struct map_info *map, struct flchip *chip, unsigned long adr); | 71 | static void put_chip(struct map_info *map, struct flchip *chip, unsigned long adr); |
72 | #include "fwh_lock.h" | 72 | #include "fwh_lock.h" |
73 | 73 | ||
74 | static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, size_t len); | 74 | static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
75 | static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, size_t len); | 75 | static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
76 | 76 | ||
77 | static struct mtd_chip_driver cfi_amdstd_chipdrv = { | 77 | static struct mtd_chip_driver cfi_amdstd_chipdrv = { |
78 | .probe = NULL, /* Not usable directly */ | 78 | .probe = NULL, /* Not usable directly */ |
@@ -1774,12 +1774,12 @@ out_unlock: | |||
1774 | return ret; | 1774 | return ret; |
1775 | } | 1775 | } |
1776 | 1776 | ||
1777 | static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | 1777 | static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
1778 | { | 1778 | { |
1779 | return cfi_varsize_frob(mtd, do_atmel_lock, ofs, len, NULL); | 1779 | return cfi_varsize_frob(mtd, do_atmel_lock, ofs, len, NULL); |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) | 1782 | static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
1783 | { | 1783 | { |
1784 | return cfi_varsize_frob(mtd, do_atmel_unlock, ofs, len, NULL); | 1784 | return cfi_varsize_frob(mtd, do_atmel_unlock, ofs, len, NULL); |
1785 | } | 1785 | } |
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index d4714dd9f7ab..6c740f346f91 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c | |||
@@ -42,8 +42,8 @@ static int cfi_staa_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
42 | unsigned long count, loff_t to, size_t *retlen); | 42 | unsigned long count, loff_t to, size_t *retlen); |
43 | static int cfi_staa_erase_varsize(struct mtd_info *, struct erase_info *); | 43 | static int cfi_staa_erase_varsize(struct mtd_info *, struct erase_info *); |
44 | static void cfi_staa_sync (struct mtd_info *); | 44 | static void cfi_staa_sync (struct mtd_info *); |
45 | static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, size_t len); | 45 | static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
46 | static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, size_t len); | 46 | static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); |
47 | static int cfi_staa_suspend (struct mtd_info *); | 47 | static int cfi_staa_suspend (struct mtd_info *); |
48 | static void cfi_staa_resume (struct mtd_info *); | 48 | static void cfi_staa_resume (struct mtd_info *); |
49 | 49 | ||
@@ -221,8 +221,8 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map) | |||
221 | } | 221 | } |
222 | 222 | ||
223 | for (i=0; i<mtd->numeraseregions;i++){ | 223 | for (i=0; i<mtd->numeraseregions;i++){ |
224 | printk(KERN_DEBUG "%d: offset=0x%x,size=0x%x,blocks=%d\n", | 224 | printk(KERN_DEBUG "%d: offset=0x%llx,size=0x%x,blocks=%d\n", |
225 | i,mtd->eraseregions[i].offset, | 225 | i, (unsigned long long)mtd->eraseregions[i].offset, |
226 | mtd->eraseregions[i].erasesize, | 226 | mtd->eraseregions[i].erasesize, |
227 | mtd->eraseregions[i].numblocks); | 227 | mtd->eraseregions[i].numblocks); |
228 | } | 228 | } |
@@ -964,7 +964,7 @@ static int cfi_staa_erase_varsize(struct mtd_info *mtd, | |||
964 | adr += regions[i].erasesize; | 964 | adr += regions[i].erasesize; |
965 | len -= regions[i].erasesize; | 965 | len -= regions[i].erasesize; |
966 | 966 | ||
967 | if (adr % (1<< cfi->chipshift) == ((regions[i].offset + (regions[i].erasesize * regions[i].numblocks)) %( 1<< cfi->chipshift))) | 967 | if (adr % (1<< cfi->chipshift) == (((unsigned long)regions[i].offset + (regions[i].erasesize * regions[i].numblocks)) %( 1<< cfi->chipshift))) |
968 | i++; | 968 | i++; |
969 | 969 | ||
970 | if (adr >> cfi->chipshift) { | 970 | if (adr >> cfi->chipshift) { |
@@ -1135,7 +1135,7 @@ retry: | |||
1135 | spin_unlock_bh(chip->mutex); | 1135 | spin_unlock_bh(chip->mutex); |
1136 | return 0; | 1136 | return 0; |
1137 | } | 1137 | } |
1138 | static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | 1138 | static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
1139 | { | 1139 | { |
1140 | struct map_info *map = mtd->priv; | 1140 | struct map_info *map = mtd->priv; |
1141 | struct cfi_private *cfi = map->fldrv_priv; | 1141 | struct cfi_private *cfi = map->fldrv_priv; |
@@ -1284,7 +1284,7 @@ retry: | |||
1284 | spin_unlock_bh(chip->mutex); | 1284 | spin_unlock_bh(chip->mutex); |
1285 | return 0; | 1285 | return 0; |
1286 | } | 1286 | } |
1287 | static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) | 1287 | static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
1288 | { | 1288 | { |
1289 | struct map_info *map = mtd->priv; | 1289 | struct map_info *map = mtd->priv; |
1290 | struct cfi_private *cfi = map->fldrv_priv; | 1290 | struct cfi_private *cfi = map->fldrv_priv; |
diff --git a/drivers/mtd/chips/fwh_lock.h b/drivers/mtd/chips/fwh_lock.h index ab44f2b996f8..57e0e4e921f9 100644 --- a/drivers/mtd/chips/fwh_lock.h +++ b/drivers/mtd/chips/fwh_lock.h | |||
@@ -77,7 +77,7 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip, | |||
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | static int fwh_lock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len) | 80 | static int fwh_lock_varsize(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
81 | { | 81 | { |
82 | int ret; | 82 | int ret; |
83 | 83 | ||
@@ -88,7 +88,7 @@ static int fwh_lock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len) | |||
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | static int fwh_unlock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len) | 91 | static int fwh_unlock_varsize(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
92 | { | 92 | { |
93 | int ret; | 93 | int ret; |
94 | 94 | ||
diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c index 50ce13887f63..73f05227dc8c 100644 --- a/drivers/mtd/inftlcore.c +++ b/drivers/mtd/inftlcore.c | |||
@@ -50,7 +50,7 @@ static void inftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
50 | struct INFTLrecord *inftl; | 50 | struct INFTLrecord *inftl; |
51 | unsigned long temp; | 51 | unsigned long temp; |
52 | 52 | ||
53 | if (mtd->type != MTD_NANDFLASH) | 53 | if (mtd->type != MTD_NANDFLASH || mtd->size > UINT_MAX) |
54 | return; | 54 | return; |
55 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ | 55 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ |
56 | if (memcmp(mtd->name, "DiskOnChip", 10)) | 56 | if (memcmp(mtd->name, "DiskOnChip", 10)) |
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c index 9113628ed1ef..f751dd97c549 100644 --- a/drivers/mtd/inftlmount.c +++ b/drivers/mtd/inftlmount.c | |||
@@ -63,7 +63,7 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
63 | * otherwise. | 63 | * otherwise. |
64 | */ | 64 | */ |
65 | inftl->EraseSize = inftl->mbd.mtd->erasesize; | 65 | inftl->EraseSize = inftl->mbd.mtd->erasesize; |
66 | inftl->nb_blocks = inftl->mbd.mtd->size / inftl->EraseSize; | 66 | inftl->nb_blocks = (u32)inftl->mbd.mtd->size / inftl->EraseSize; |
67 | 67 | ||
68 | inftl->MediaUnit = BLOCK_NIL; | 68 | inftl->MediaUnit = BLOCK_NIL; |
69 | 69 | ||
@@ -187,7 +187,7 @@ static int find_boot_record(struct INFTLrecord *inftl) | |||
187 | mh->BlockMultiplierBits); | 187 | mh->BlockMultiplierBits); |
188 | inftl->EraseSize = inftl->mbd.mtd->erasesize << | 188 | inftl->EraseSize = inftl->mbd.mtd->erasesize << |
189 | mh->BlockMultiplierBits; | 189 | mh->BlockMultiplierBits; |
190 | inftl->nb_blocks = inftl->mbd.mtd->size / inftl->EraseSize; | 190 | inftl->nb_blocks = (u32)inftl->mbd.mtd->size / inftl->EraseSize; |
191 | block >>= mh->BlockMultiplierBits; | 191 | block >>= mh->BlockMultiplierBits; |
192 | } | 192 | } |
193 | 193 | ||
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index d1eec7d3243f..237733d094c4 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c | |||
@@ -232,8 +232,8 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, | |||
232 | /* Trim the size if we are larger than the map */ | 232 | /* Trim the size if we are larger than the map */ |
233 | if (map->mtd->size > map->map.size) { | 233 | if (map->mtd->size > map->map.size) { |
234 | printk(KERN_WARNING MOD_NAME | 234 | printk(KERN_WARNING MOD_NAME |
235 | " rom(%u) larger than window(%lu). fixing...\n", | 235 | " rom(%llu) larger than window(%lu). fixing...\n", |
236 | map->mtd->size, map->map.size); | 236 | (unsigned long long)map->mtd->size, map->map.size); |
237 | map->mtd->size = map->map.size; | 237 | map->mtd->size = map->map.size; |
238 | } | 238 | } |
239 | if (window->rsrc.parent) { | 239 | if (window->rsrc.parent) { |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 1a6feb4474de..5f7a245ed132 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
@@ -263,8 +263,8 @@ static int __devinit ck804xrom_init_one (struct pci_dev *pdev, | |||
263 | /* Trim the size if we are larger than the map */ | 263 | /* Trim the size if we are larger than the map */ |
264 | if (map->mtd->size > map->map.size) { | 264 | if (map->mtd->size > map->map.size) { |
265 | printk(KERN_WARNING MOD_NAME | 265 | printk(KERN_WARNING MOD_NAME |
266 | " rom(%u) larger than window(%lu). fixing...\n", | 266 | " rom(%llu) larger than window(%lu). fixing...\n", |
267 | map->mtd->size, map->map.size); | 267 | (unsigned long long)map->mtd->size, map->map.size); |
268 | map->mtd->size = map->map.size; | 268 | map->mtd->size = map->map.size; |
269 | } | 269 | } |
270 | if (window->rsrc.parent) { | 270 | if (window->rsrc.parent) { |
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c index bbbcdd4c8d13..11a2f57df9cf 100644 --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c | |||
@@ -324,8 +324,8 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev, | |||
324 | /* Trim the size if we are larger than the map */ | 324 | /* Trim the size if we are larger than the map */ |
325 | if (map->mtd->size > map->map.size) { | 325 | if (map->mtd->size > map->map.size) { |
326 | printk(KERN_WARNING MOD_NAME | 326 | printk(KERN_WARNING MOD_NAME |
327 | " rom(%u) larger than window(%lu). fixing...\n", | 327 | " rom(%llu) larger than window(%lu). fixing...\n", |
328 | map->mtd->size, map->map.size); | 328 | (unsigned long long)map->mtd->size, map->map.size); |
329 | map->mtd->size = map->map.size; | 329 | map->mtd->size = map->map.size; |
330 | } | 330 | } |
331 | if (window->rsrc.parent) { | 331 | if (window->rsrc.parent) { |
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c index aeb6c916e23f..c32bc28920b3 100644 --- a/drivers/mtd/maps/ichxrom.c +++ b/drivers/mtd/maps/ichxrom.c | |||
@@ -258,8 +258,8 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev, | |||
258 | /* Trim the size if we are larger than the map */ | 258 | /* Trim the size if we are larger than the map */ |
259 | if (map->mtd->size > map->map.size) { | 259 | if (map->mtd->size > map->map.size) { |
260 | printk(KERN_WARNING MOD_NAME | 260 | printk(KERN_WARNING MOD_NAME |
261 | " rom(%u) larger than window(%lu). fixing...\n", | 261 | " rom(%llu) larger than window(%lu). fixing...\n", |
262 | map->mtd->size, map->map.size); | 262 | (unsigned long long)map->mtd->size, map->map.size); |
263 | map->mtd->size = map->map.size; | 263 | map->mtd->size = map->map.size; |
264 | } | 264 | } |
265 | if (window->rsrc.parent) { | 265 | if (window->rsrc.parent) { |
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c index 965e6c6d6ab0..a8723a6b7457 100644 --- a/drivers/mtd/maps/nettel.c +++ b/drivers/mtd/maps/nettel.c | |||
@@ -226,7 +226,7 @@ static int __init nettel_init(void) | |||
226 | 226 | ||
227 | if ((amd_mtd = do_map_probe("jedec_probe", &nettel_amd_map))) { | 227 | if ((amd_mtd = do_map_probe("jedec_probe", &nettel_amd_map))) { |
228 | printk(KERN_NOTICE "SNAPGEAR: AMD flash device size = %dK\n", | 228 | printk(KERN_NOTICE "SNAPGEAR: AMD flash device size = %dK\n", |
229 | amd_mtd->size>>10); | 229 | (int)(amd_mtd->size>>10)); |
230 | 230 | ||
231 | amd_mtd->owner = THIS_MODULE; | 231 | amd_mtd->owner = THIS_MODULE; |
232 | 232 | ||
diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c index 21169e6d646c..7e329f09a548 100644 --- a/drivers/mtd/maps/scb2_flash.c +++ b/drivers/mtd/maps/scb2_flash.c | |||
@@ -118,7 +118,8 @@ scb2_fixup_mtd(struct mtd_info *mtd) | |||
118 | struct mtd_erase_region_info *region = &mtd->eraseregions[i]; | 118 | struct mtd_erase_region_info *region = &mtd->eraseregions[i]; |
119 | 119 | ||
120 | if (region->numblocks * region->erasesize > mtd->size) { | 120 | if (region->numblocks * region->erasesize > mtd->size) { |
121 | region->numblocks = (mtd->size / region->erasesize); | 121 | region->numblocks = ((unsigned long)mtd->size / |
122 | region->erasesize); | ||
122 | done = 1; | 123 | done = 1; |
123 | } else { | 124 | } else { |
124 | region->numblocks = 0; | 125 | region->numblocks = 0; |
@@ -187,8 +188,9 @@ scb2_flash_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
187 | return -ENODEV; | 188 | return -ENODEV; |
188 | } | 189 | } |
189 | 190 | ||
190 | printk(KERN_NOTICE MODNAME ": chip size 0x%x at offset 0x%x\n", | 191 | printk(KERN_NOTICE MODNAME ": chip size 0x%llx at offset 0x%llx\n", |
191 | scb2_mtd->size, SCB2_WINDOW - scb2_mtd->size); | 192 | (unsigned long long)scb2_mtd->size, |
193 | (unsigned long long)(SCB2_WINDOW - scb2_mtd->size)); | ||
192 | 194 | ||
193 | add_mtd_device(scb2_mtd); | 195 | add_mtd_device(scb2_mtd); |
194 | 196 | ||
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index bcffeda2df3d..e9ec59e9a566 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -450,16 +450,20 @@ static int mtd_ioctl(struct inode *inode, struct file *file, | |||
450 | if (!erase) | 450 | if (!erase) |
451 | ret = -ENOMEM; | 451 | ret = -ENOMEM; |
452 | else { | 452 | else { |
453 | struct erase_info_user einfo; | ||
454 | |||
453 | wait_queue_head_t waitq; | 455 | wait_queue_head_t waitq; |
454 | DECLARE_WAITQUEUE(wait, current); | 456 | DECLARE_WAITQUEUE(wait, current); |
455 | 457 | ||
456 | init_waitqueue_head(&waitq); | 458 | init_waitqueue_head(&waitq); |
457 | 459 | ||
458 | if (copy_from_user(&erase->addr, argp, | 460 | if (copy_from_user(&einfo, argp, |
459 | sizeof(struct erase_info_user))) { | 461 | sizeof(struct erase_info_user))) { |
460 | kfree(erase); | 462 | kfree(erase); |
461 | return -EFAULT; | 463 | return -EFAULT; |
462 | } | 464 | } |
465 | erase->addr = einfo.start; | ||
466 | erase->len = einfo.length; | ||
463 | erase->mtd = mtd; | 467 | erase->mtd = mtd; |
464 | erase->callback = mtdchar_erase_callback; | 468 | erase->callback = mtdchar_erase_callback; |
465 | erase->priv = (unsigned long)&waitq; | 469 | erase->priv = (unsigned long)&waitq; |
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 789842d0e6f2..ff8c14bcac68 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -197,7 +197,7 @@ concat_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
197 | continue; | 197 | continue; |
198 | } | 198 | } |
199 | 199 | ||
200 | size = min(total_len, (size_t)(subdev->size - to)); | 200 | size = min_t(uint64_t, total_len, subdev->size - to); |
201 | wsize = size; /* store for future use */ | 201 | wsize = size; /* store for future use */ |
202 | 202 | ||
203 | entry_high = entry_low; | 203 | entry_high = entry_low; |
@@ -385,7 +385,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
385 | struct mtd_concat *concat = CONCAT(mtd); | 385 | struct mtd_concat *concat = CONCAT(mtd); |
386 | struct mtd_info *subdev; | 386 | struct mtd_info *subdev; |
387 | int i, err; | 387 | int i, err; |
388 | u_int32_t length, offset = 0; | 388 | uint64_t length, offset = 0; |
389 | struct erase_info *erase; | 389 | struct erase_info *erase; |
390 | 390 | ||
391 | if (!(mtd->flags & MTD_WRITEABLE)) | 391 | if (!(mtd->flags & MTD_WRITEABLE)) |
@@ -518,7 +518,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
518 | return 0; | 518 | return 0; |
519 | } | 519 | } |
520 | 520 | ||
521 | static int concat_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | 521 | static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
522 | { | 522 | { |
523 | struct mtd_concat *concat = CONCAT(mtd); | 523 | struct mtd_concat *concat = CONCAT(mtd); |
524 | int i, err = -EINVAL; | 524 | int i, err = -EINVAL; |
@@ -528,7 +528,7 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | |||
528 | 528 | ||
529 | for (i = 0; i < concat->num_subdev; i++) { | 529 | for (i = 0; i < concat->num_subdev; i++) { |
530 | struct mtd_info *subdev = concat->subdev[i]; | 530 | struct mtd_info *subdev = concat->subdev[i]; |
531 | size_t size; | 531 | uint64_t size; |
532 | 532 | ||
533 | if (ofs >= subdev->size) { | 533 | if (ofs >= subdev->size) { |
534 | size = 0; | 534 | size = 0; |
@@ -556,7 +556,7 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | |||
556 | return err; | 556 | return err; |
557 | } | 557 | } |
558 | 558 | ||
559 | static int concat_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) | 559 | static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
560 | { | 560 | { |
561 | struct mtd_concat *concat = CONCAT(mtd); | 561 | struct mtd_concat *concat = CONCAT(mtd); |
562 | int i, err = 0; | 562 | int i, err = 0; |
@@ -566,7 +566,7 @@ static int concat_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) | |||
566 | 566 | ||
567 | for (i = 0; i < concat->num_subdev; i++) { | 567 | for (i = 0; i < concat->num_subdev; i++) { |
568 | struct mtd_info *subdev = concat->subdev[i]; | 568 | struct mtd_info *subdev = concat->subdev[i]; |
569 | size_t size; | 569 | uint64_t size; |
570 | 570 | ||
571 | if (ofs >= subdev->size) { | 571 | if (ofs >= subdev->size) { |
572 | size = 0; | 572 | size = 0; |
@@ -842,12 +842,14 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
842 | concat->mtd.erasesize = curr_erasesize; | 842 | concat->mtd.erasesize = curr_erasesize; |
843 | concat->mtd.numeraseregions = 0; | 843 | concat->mtd.numeraseregions = 0; |
844 | } else { | 844 | } else { |
845 | uint64_t tmp64; | ||
846 | |||
845 | /* | 847 | /* |
846 | * erase block size varies across the subdevices: allocate | 848 | * erase block size varies across the subdevices: allocate |
847 | * space to store the data describing the variable erase regions | 849 | * space to store the data describing the variable erase regions |
848 | */ | 850 | */ |
849 | struct mtd_erase_region_info *erase_region_p; | 851 | struct mtd_erase_region_info *erase_region_p; |
850 | u_int32_t begin, position; | 852 | uint64_t begin, position; |
851 | 853 | ||
852 | concat->mtd.erasesize = max_erasesize; | 854 | concat->mtd.erasesize = max_erasesize; |
853 | concat->mtd.numeraseregions = num_erase_region; | 855 | concat->mtd.numeraseregions = num_erase_region; |
@@ -879,8 +881,9 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
879 | erase_region_p->offset = begin; | 881 | erase_region_p->offset = begin; |
880 | erase_region_p->erasesize = | 882 | erase_region_p->erasesize = |
881 | curr_erasesize; | 883 | curr_erasesize; |
882 | erase_region_p->numblocks = | 884 | tmp64 = position - begin; |
883 | (position - begin) / curr_erasesize; | 885 | do_div(tmp64, curr_erasesize); |
886 | erase_region_p->numblocks = tmp64; | ||
884 | begin = position; | 887 | begin = position; |
885 | 888 | ||
886 | curr_erasesize = subdev[i]->erasesize; | 889 | curr_erasesize = subdev[i]->erasesize; |
@@ -897,9 +900,9 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
897 | erase_region_p->offset = begin; | 900 | erase_region_p->offset = begin; |
898 | erase_region_p->erasesize = | 901 | erase_region_p->erasesize = |
899 | curr_erasesize; | 902 | curr_erasesize; |
900 | erase_region_p->numblocks = | 903 | tmp64 = position - begin; |
901 | (position - | 904 | do_div(tmp64, curr_erasesize); |
902 | begin) / curr_erasesize; | 905 | erase_region_p->numblocks = tmp64; |
903 | begin = position; | 906 | begin = position; |
904 | 907 | ||
905 | curr_erasesize = | 908 | curr_erasesize = |
@@ -909,14 +912,16 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
909 | } | 912 | } |
910 | position += | 913 | position += |
911 | subdev[i]->eraseregions[j]. | 914 | subdev[i]->eraseregions[j]. |
912 | numblocks * curr_erasesize; | 915 | numblocks * (uint64_t)curr_erasesize; |
913 | } | 916 | } |
914 | } | 917 | } |
915 | } | 918 | } |
916 | /* Now write the final entry */ | 919 | /* Now write the final entry */ |
917 | erase_region_p->offset = begin; | 920 | erase_region_p->offset = begin; |
918 | erase_region_p->erasesize = curr_erasesize; | 921 | erase_region_p->erasesize = curr_erasesize; |
919 | erase_region_p->numblocks = (position - begin) / curr_erasesize; | 922 | tmp64 = position - begin; |
923 | do_div(tmp64, curr_erasesize); | ||
924 | erase_region_p->numblocks = tmp64; | ||
920 | } | 925 | } |
921 | 926 | ||
922 | return &concat->mtd; | 927 | return &concat->mtd; |
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index a9d246949820..76fe0a1e7a5e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -57,6 +57,19 @@ int add_mtd_device(struct mtd_info *mtd) | |||
57 | mtd->index = i; | 57 | mtd->index = i; |
58 | mtd->usecount = 0; | 58 | mtd->usecount = 0; |
59 | 59 | ||
60 | if (is_power_of_2(mtd->erasesize)) | ||
61 | mtd->erasesize_shift = ffs(mtd->erasesize) - 1; | ||
62 | else | ||
63 | mtd->erasesize_shift = 0; | ||
64 | |||
65 | if (is_power_of_2(mtd->writesize)) | ||
66 | mtd->writesize_shift = ffs(mtd->writesize) - 1; | ||
67 | else | ||
68 | mtd->writesize_shift = 0; | ||
69 | |||
70 | mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1; | ||
71 | mtd->writesize_mask = (1 << mtd->writesize_shift) - 1; | ||
72 | |||
60 | /* Some chips always power up locked. Unlock them now */ | 73 | /* Some chips always power up locked. Unlock them now */ |
61 | if ((mtd->flags & MTD_WRITEABLE) | 74 | if ((mtd->flags & MTD_WRITEABLE) |
62 | && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) { | 75 | && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) { |
@@ -344,7 +357,8 @@ static inline int mtd_proc_info (char *buf, int i) | |||
344 | if (!this) | 357 | if (!this) |
345 | return 0; | 358 | return 0; |
346 | 359 | ||
347 | return sprintf(buf, "mtd%d: %8.8x %8.8x \"%s\"\n", i, this->size, | 360 | return sprintf(buf, "mtd%d: %8.8llx %8.8x \"%s\"\n", i, |
361 | (unsigned long long)this->size, | ||
348 | this->erasesize, this->name); | 362 | this->erasesize, this->name); |
349 | } | 363 | } |
350 | 364 | ||
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index aebb3b27edbd..1a6b3beabe8d 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c | |||
@@ -80,9 +80,9 @@ static int mtdoops_erase_block(struct mtd_info *mtd, int offset) | |||
80 | if (ret) { | 80 | if (ret) { |
81 | set_current_state(TASK_RUNNING); | 81 | set_current_state(TASK_RUNNING); |
82 | remove_wait_queue(&wait_q, &wait); | 82 | remove_wait_queue(&wait_q, &wait); |
83 | printk (KERN_WARNING "mtdoops: erase of region [0x%x, 0x%x] " | 83 | printk (KERN_WARNING "mtdoops: erase of region [0x%llx, 0x%llx] " |
84 | "on \"%s\" failed\n", | 84 | "on \"%s\" failed\n", |
85 | erase.addr, erase.len, mtd->name); | 85 | (unsigned long long)erase.addr, (unsigned long long)erase.len, mtd->name); |
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
88 | 88 | ||
@@ -289,7 +289,10 @@ static void mtdoops_notify_add(struct mtd_info *mtd) | |||
289 | } | 289 | } |
290 | 290 | ||
291 | cxt->mtd = mtd; | 291 | cxt->mtd = mtd; |
292 | cxt->oops_pages = mtd->size / OOPS_PAGE_SIZE; | 292 | if (mtd->size > INT_MAX) |
293 | cxt->oops_pages = INT_MAX / OOPS_PAGE_SIZE; | ||
294 | else | ||
295 | cxt->oops_pages = (int)mtd->size / OOPS_PAGE_SIZE; | ||
293 | 296 | ||
294 | find_next_position(cxt); | 297 | find_next_position(cxt); |
295 | 298 | ||
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 3728913fa5fa..144e6b613a77 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -26,7 +26,7 @@ static LIST_HEAD(mtd_partitions); | |||
26 | struct mtd_part { | 26 | struct mtd_part { |
27 | struct mtd_info mtd; | 27 | struct mtd_info mtd; |
28 | struct mtd_info *master; | 28 | struct mtd_info *master; |
29 | u_int32_t offset; | 29 | uint64_t offset; |
30 | int index; | 30 | int index; |
31 | struct list_head list; | 31 | struct list_head list; |
32 | int registered; | 32 | int registered; |
@@ -235,7 +235,7 @@ void mtd_erase_callback(struct erase_info *instr) | |||
235 | } | 235 | } |
236 | EXPORT_SYMBOL_GPL(mtd_erase_callback); | 236 | EXPORT_SYMBOL_GPL(mtd_erase_callback); |
237 | 237 | ||
238 | static int part_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | 238 | static int part_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
239 | { | 239 | { |
240 | struct mtd_part *part = PART(mtd); | 240 | struct mtd_part *part = PART(mtd); |
241 | if ((len + ofs) > mtd->size) | 241 | if ((len + ofs) > mtd->size) |
@@ -243,7 +243,7 @@ static int part_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | |||
243 | return part->master->lock(part->master, ofs + part->offset, len); | 243 | return part->master->lock(part->master, ofs + part->offset, len); |
244 | } | 244 | } |
245 | 245 | ||
246 | static int part_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) | 246 | static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
247 | { | 247 | { |
248 | struct mtd_part *part = PART(mtd); | 248 | struct mtd_part *part = PART(mtd); |
249 | if ((len + ofs) > mtd->size) | 249 | if ((len + ofs) > mtd->size) |
@@ -317,7 +317,7 @@ EXPORT_SYMBOL(del_mtd_partitions); | |||
317 | 317 | ||
318 | static struct mtd_part *add_one_partition(struct mtd_info *master, | 318 | static struct mtd_part *add_one_partition(struct mtd_info *master, |
319 | const struct mtd_partition *part, int partno, | 319 | const struct mtd_partition *part, int partno, |
320 | u_int32_t cur_offset) | 320 | uint64_t cur_offset) |
321 | { | 321 | { |
322 | struct mtd_part *slave; | 322 | struct mtd_part *slave; |
323 | 323 | ||
@@ -395,19 +395,19 @@ static struct mtd_part *add_one_partition(struct mtd_info *master, | |||
395 | slave->offset = cur_offset; | 395 | slave->offset = cur_offset; |
396 | if (slave->offset == MTDPART_OFS_NXTBLK) { | 396 | if (slave->offset == MTDPART_OFS_NXTBLK) { |
397 | slave->offset = cur_offset; | 397 | slave->offset = cur_offset; |
398 | if ((cur_offset % master->erasesize) != 0) { | 398 | if (mtd_mod_by_eb(cur_offset, master) != 0) { |
399 | /* Round up to next erasesize */ | 399 | /* Round up to next erasesize */ |
400 | slave->offset = ((cur_offset / master->erasesize) + 1) * master->erasesize; | 400 | slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; |
401 | printk(KERN_NOTICE "Moving partition %d: " | 401 | printk(KERN_NOTICE "Moving partition %d: " |
402 | "0x%08x -> 0x%08x\n", partno, | 402 | "0x%012llx -> 0x%012llx\n", partno, |
403 | cur_offset, slave->offset); | 403 | (unsigned long long)cur_offset, (unsigned long long)slave->offset); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | if (slave->mtd.size == MTDPART_SIZ_FULL) | 406 | if (slave->mtd.size == MTDPART_SIZ_FULL) |
407 | slave->mtd.size = master->size - slave->offset; | 407 | slave->mtd.size = master->size - slave->offset; |
408 | 408 | ||
409 | printk(KERN_NOTICE "0x%08x-0x%08x : \"%s\"\n", slave->offset, | 409 | printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long long)slave->offset, |
410 | slave->offset + slave->mtd.size, slave->mtd.name); | 410 | (unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name); |
411 | 411 | ||
412 | /* let's do some sanity checks */ | 412 | /* let's do some sanity checks */ |
413 | if (slave->offset >= master->size) { | 413 | if (slave->offset >= master->size) { |
@@ -420,13 +420,13 @@ static struct mtd_part *add_one_partition(struct mtd_info *master, | |||
420 | } | 420 | } |
421 | if (slave->offset + slave->mtd.size > master->size) { | 421 | if (slave->offset + slave->mtd.size > master->size) { |
422 | slave->mtd.size = master->size - slave->offset; | 422 | slave->mtd.size = master->size - slave->offset; |
423 | printk(KERN_WARNING"mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#x\n", | 423 | printk(KERN_WARNING"mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#llx\n", |
424 | part->name, master->name, slave->mtd.size); | 424 | part->name, master->name, (unsigned long long)slave->mtd.size); |
425 | } | 425 | } |
426 | if (master->numeraseregions > 1) { | 426 | if (master->numeraseregions > 1) { |
427 | /* Deal with variable erase size stuff */ | 427 | /* Deal with variable erase size stuff */ |
428 | int i, max = master->numeraseregions; | 428 | int i, max = master->numeraseregions; |
429 | u32 end = slave->offset + slave->mtd.size; | 429 | u64 end = slave->offset + slave->mtd.size; |
430 | struct mtd_erase_region_info *regions = master->eraseregions; | 430 | struct mtd_erase_region_info *regions = master->eraseregions; |
431 | 431 | ||
432 | /* Find the first erase regions which is part of this | 432 | /* Find the first erase regions which is part of this |
@@ -449,7 +449,7 @@ static struct mtd_part *add_one_partition(struct mtd_info *master, | |||
449 | } | 449 | } |
450 | 450 | ||
451 | if ((slave->mtd.flags & MTD_WRITEABLE) && | 451 | if ((slave->mtd.flags & MTD_WRITEABLE) && |
452 | (slave->offset % slave->mtd.erasesize)) { | 452 | mtd_mod_by_eb(slave->offset, &slave->mtd)) { |
453 | /* Doesn't start on a boundary of major erase size */ | 453 | /* Doesn't start on a boundary of major erase size */ |
454 | /* FIXME: Let it be writable if it is on a boundary of | 454 | /* FIXME: Let it be writable if it is on a boundary of |
455 | * _minor_ erase size though */ | 455 | * _minor_ erase size though */ |
@@ -458,7 +458,7 @@ static struct mtd_part *add_one_partition(struct mtd_info *master, | |||
458 | part->name); | 458 | part->name); |
459 | } | 459 | } |
460 | if ((slave->mtd.flags & MTD_WRITEABLE) && | 460 | if ((slave->mtd.flags & MTD_WRITEABLE) && |
461 | (slave->mtd.size % slave->mtd.erasesize)) { | 461 | mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { |
462 | slave->mtd.flags &= ~MTD_WRITEABLE; | 462 | slave->mtd.flags &= ~MTD_WRITEABLE; |
463 | printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", | 463 | printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", |
464 | part->name); | 464 | part->name); |
@@ -466,7 +466,7 @@ static struct mtd_part *add_one_partition(struct mtd_info *master, | |||
466 | 466 | ||
467 | slave->mtd.ecclayout = master->ecclayout; | 467 | slave->mtd.ecclayout = master->ecclayout; |
468 | if (master->block_isbad) { | 468 | if (master->block_isbad) { |
469 | uint32_t offs = 0; | 469 | uint64_t offs = 0; |
470 | 470 | ||
471 | while (offs < slave->mtd.size) { | 471 | while (offs < slave->mtd.size) { |
472 | if (master->block_isbad(master, | 472 | if (master->block_isbad(master, |
@@ -501,7 +501,7 @@ int add_mtd_partitions(struct mtd_info *master, | |||
501 | int nbparts) | 501 | int nbparts) |
502 | { | 502 | { |
503 | struct mtd_part *slave; | 503 | struct mtd_part *slave; |
504 | u_int32_t cur_offset = 0; | 504 | uint64_t cur_offset = 0; |
505 | int i; | 505 | int i; |
506 | 506 | ||
507 | printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); | 507 | printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 0a9c9cd33f96..ff2d33e4d6d6 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2014,13 +2014,14 @@ static int nand_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
2014 | int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | 2014 | int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, |
2015 | int allowbbt) | 2015 | int allowbbt) |
2016 | { | 2016 | { |
2017 | int page, len, status, pages_per_block, ret, chipnr; | 2017 | int page, status, pages_per_block, ret, chipnr; |
2018 | struct nand_chip *chip = mtd->priv; | 2018 | struct nand_chip *chip = mtd->priv; |
2019 | int rewrite_bbt[NAND_MAX_CHIPS]={0}; | 2019 | loff_t rewrite_bbt[NAND_MAX_CHIPS]={0}; |
2020 | unsigned int bbt_masked_page = 0xffffffff; | 2020 | unsigned int bbt_masked_page = 0xffffffff; |
2021 | loff_t len; | ||
2021 | 2022 | ||
2022 | DEBUG(MTD_DEBUG_LEVEL3, "nand_erase: start = 0x%08x, len = %i\n", | 2023 | DEBUG(MTD_DEBUG_LEVEL3, "nand_erase: start = 0x%012llx, len = %llu\n", |
2023 | (unsigned int)instr->addr, (unsigned int)instr->len); | 2024 | (unsigned long long)instr->addr, (unsigned long long)instr->len); |
2024 | 2025 | ||
2025 | /* Start address must align on block boundary */ | 2026 | /* Start address must align on block boundary */ |
2026 | if (instr->addr & ((1 << chip->phys_erase_shift) - 1)) { | 2027 | if (instr->addr & ((1 << chip->phys_erase_shift) - 1)) { |
@@ -2116,7 +2117,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | |||
2116 | DEBUG(MTD_DEBUG_LEVEL0, "nand_erase: " | 2117 | DEBUG(MTD_DEBUG_LEVEL0, "nand_erase: " |
2117 | "Failed erase, page 0x%08x\n", page); | 2118 | "Failed erase, page 0x%08x\n", page); |
2118 | instr->state = MTD_ERASE_FAILED; | 2119 | instr->state = MTD_ERASE_FAILED; |
2119 | instr->fail_addr = (page << chip->page_shift); | 2120 | instr->fail_addr = |
2121 | ((loff_t)page << chip->page_shift); | ||
2120 | goto erase_exit; | 2122 | goto erase_exit; |
2121 | } | 2123 | } |
2122 | 2124 | ||
@@ -2126,7 +2128,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | |||
2126 | */ | 2128 | */ |
2127 | if (bbt_masked_page != 0xffffffff && | 2129 | if (bbt_masked_page != 0xffffffff && |
2128 | (page & BBT_PAGE_MASK) == bbt_masked_page) | 2130 | (page & BBT_PAGE_MASK) == bbt_masked_page) |
2129 | rewrite_bbt[chipnr] = (page << chip->page_shift); | 2131 | rewrite_bbt[chipnr] = |
2132 | ((loff_t)page << chip->page_shift); | ||
2130 | 2133 | ||
2131 | /* Increment page address and decrement length */ | 2134 | /* Increment page address and decrement length */ |
2132 | len -= (1 << chip->phys_erase_shift); | 2135 | len -= (1 << chip->phys_erase_shift); |
@@ -2173,7 +2176,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | |||
2173 | continue; | 2176 | continue; |
2174 | /* update the BBT for chip */ | 2177 | /* update the BBT for chip */ |
2175 | DEBUG(MTD_DEBUG_LEVEL0, "nand_erase_nand: nand_update_bbt " | 2178 | DEBUG(MTD_DEBUG_LEVEL0, "nand_erase_nand: nand_update_bbt " |
2176 | "(%d:0x%0x 0x%0x)\n", chipnr, rewrite_bbt[chipnr], | 2179 | "(%d:0x%0llx 0x%0x)\n", chipnr, rewrite_bbt[chipnr], |
2177 | chip->bbt_td->pages[chipnr]); | 2180 | chip->bbt_td->pages[chipnr]); |
2178 | nand_update_bbt(mtd, rewrite_bbt[chipnr]); | 2181 | nand_update_bbt(mtd, rewrite_bbt[chipnr]); |
2179 | } | 2182 | } |
@@ -2365,7 +2368,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2365 | if (!mtd->name) | 2368 | if (!mtd->name) |
2366 | mtd->name = type->name; | 2369 | mtd->name = type->name; |
2367 | 2370 | ||
2368 | chip->chipsize = type->chipsize << 20; | 2371 | chip->chipsize = (uint64_t)type->chipsize << 20; |
2369 | 2372 | ||
2370 | /* Newer devices have all the information in additional id bytes */ | 2373 | /* Newer devices have all the information in additional id bytes */ |
2371 | if (!type->pagesize) { | 2374 | if (!type->pagesize) { |
@@ -2423,7 +2426,10 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2423 | 2426 | ||
2424 | chip->bbt_erase_shift = chip->phys_erase_shift = | 2427 | chip->bbt_erase_shift = chip->phys_erase_shift = |
2425 | ffs(mtd->erasesize) - 1; | 2428 | ffs(mtd->erasesize) - 1; |
2426 | chip->chip_shift = ffs(chip->chipsize) - 1; | 2429 | if (chip->chipsize & 0xffffffff) |
2430 | chip->chip_shift = ffs((unsigned)chip->chipsize) - 1; | ||
2431 | else | ||
2432 | chip->chip_shift = ffs((unsigned)(chip->chipsize >> 32)) + 32 - 1; | ||
2427 | 2433 | ||
2428 | /* Set the bad block position */ | 2434 | /* Set the bad block position */ |
2429 | chip->badblockpos = mtd->writesize > 512 ? | 2435 | chip->badblockpos = mtd->writesize > 512 ? |
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index 0b1c48595f12..55c23e5cd210 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -171,16 +171,16 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num, | |||
171 | if (tmp == msk) | 171 | if (tmp == msk) |
172 | continue; | 172 | continue; |
173 | if (reserved_block_code && (tmp == reserved_block_code)) { | 173 | if (reserved_block_code && (tmp == reserved_block_code)) { |
174 | printk(KERN_DEBUG "nand_read_bbt: Reserved block at 0x%08x\n", | 174 | printk(KERN_DEBUG "nand_read_bbt: Reserved block at 0x%012llx\n", |
175 | ((offs << 2) + (act >> 1)) << this->bbt_erase_shift); | 175 | (loff_t)((offs << 2) + (act >> 1)) << this->bbt_erase_shift); |
176 | this->bbt[offs + (act >> 3)] |= 0x2 << (act & 0x06); | 176 | this->bbt[offs + (act >> 3)] |= 0x2 << (act & 0x06); |
177 | mtd->ecc_stats.bbtblocks++; | 177 | mtd->ecc_stats.bbtblocks++; |
178 | continue; | 178 | continue; |
179 | } | 179 | } |
180 | /* Leave it for now, if its matured we can move this | 180 | /* Leave it for now, if its matured we can move this |
181 | * message to MTD_DEBUG_LEVEL0 */ | 181 | * message to MTD_DEBUG_LEVEL0 */ |
182 | printk(KERN_DEBUG "nand_read_bbt: Bad block at 0x%08x\n", | 182 | printk(KERN_DEBUG "nand_read_bbt: Bad block at 0x%012llx\n", |
183 | ((offs << 2) + (act >> 1)) << this->bbt_erase_shift); | 183 | (loff_t)((offs << 2) + (act >> 1)) << this->bbt_erase_shift); |
184 | /* Factory marked bad or worn out ? */ | 184 | /* Factory marked bad or worn out ? */ |
185 | if (tmp == 0) | 185 | if (tmp == 0) |
186 | this->bbt[offs + (act >> 3)] |= 0x3 << (act & 0x06); | 186 | this->bbt[offs + (act >> 3)] |= 0x3 << (act & 0x06); |
@@ -284,7 +284,7 @@ static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf, | |||
284 | 284 | ||
285 | /* Read the primary version, if available */ | 285 | /* Read the primary version, if available */ |
286 | if (td->options & NAND_BBT_VERSION) { | 286 | if (td->options & NAND_BBT_VERSION) { |
287 | scan_read_raw(mtd, buf, td->pages[0] << this->page_shift, | 287 | scan_read_raw(mtd, buf, (loff_t)td->pages[0] << this->page_shift, |
288 | mtd->writesize); | 288 | mtd->writesize); |
289 | td->version[0] = buf[mtd->writesize + td->veroffs]; | 289 | td->version[0] = buf[mtd->writesize + td->veroffs]; |
290 | printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", | 290 | printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", |
@@ -293,7 +293,7 @@ static int read_abs_bbts(struct mtd_info *mtd, uint8_t *buf, | |||
293 | 293 | ||
294 | /* Read the mirror version, if available */ | 294 | /* Read the mirror version, if available */ |
295 | if (md && (md->options & NAND_BBT_VERSION)) { | 295 | if (md && (md->options & NAND_BBT_VERSION)) { |
296 | scan_read_raw(mtd, buf, md->pages[0] << this->page_shift, | 296 | scan_read_raw(mtd, buf, (loff_t)md->pages[0] << this->page_shift, |
297 | mtd->writesize); | 297 | mtd->writesize); |
298 | md->version[0] = buf[mtd->writesize + md->veroffs]; | 298 | md->version[0] = buf[mtd->writesize + md->veroffs]; |
299 | printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", | 299 | printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", |
@@ -411,7 +411,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
411 | numblocks = this->chipsize >> (this->bbt_erase_shift - 1); | 411 | numblocks = this->chipsize >> (this->bbt_erase_shift - 1); |
412 | startblock = chip * numblocks; | 412 | startblock = chip * numblocks; |
413 | numblocks += startblock; | 413 | numblocks += startblock; |
414 | from = startblock << (this->bbt_erase_shift - 1); | 414 | from = (loff_t)startblock << (this->bbt_erase_shift - 1); |
415 | } | 415 | } |
416 | 416 | ||
417 | for (i = startblock; i < numblocks;) { | 417 | for (i = startblock; i < numblocks;) { |
@@ -428,8 +428,8 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
428 | 428 | ||
429 | if (ret) { | 429 | if (ret) { |
430 | this->bbt[i >> 3] |= 0x03 << (i & 0x6); | 430 | this->bbt[i >> 3] |= 0x03 << (i & 0x6); |
431 | printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", | 431 | printk(KERN_WARNING "Bad eraseblock %d at 0x%012llx\n", |
432 | i >> 1, (unsigned int)from); | 432 | i >> 1, (unsigned long long)from); |
433 | mtd->ecc_stats.badblocks++; | 433 | mtd->ecc_stats.badblocks++; |
434 | } | 434 | } |
435 | 435 | ||
@@ -495,7 +495,7 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr | |||
495 | for (block = 0; block < td->maxblocks; block++) { | 495 | for (block = 0; block < td->maxblocks; block++) { |
496 | 496 | ||
497 | int actblock = startblock + dir * block; | 497 | int actblock = startblock + dir * block; |
498 | loff_t offs = actblock << this->bbt_erase_shift; | 498 | loff_t offs = (loff_t)actblock << this->bbt_erase_shift; |
499 | 499 | ||
500 | /* Read first page */ | 500 | /* Read first page */ |
501 | scan_read_raw(mtd, buf, offs, mtd->writesize); | 501 | scan_read_raw(mtd, buf, offs, mtd->writesize); |
@@ -719,7 +719,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
719 | 719 | ||
720 | memset(&einfo, 0, sizeof(einfo)); | 720 | memset(&einfo, 0, sizeof(einfo)); |
721 | einfo.mtd = mtd; | 721 | einfo.mtd = mtd; |
722 | einfo.addr = (unsigned long)to; | 722 | einfo.addr = to; |
723 | einfo.len = 1 << this->bbt_erase_shift; | 723 | einfo.len = 1 << this->bbt_erase_shift; |
724 | res = nand_erase_nand(mtd, &einfo, 1); | 724 | res = nand_erase_nand(mtd, &einfo, 1); |
725 | if (res < 0) | 725 | if (res < 0) |
@@ -729,8 +729,8 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
729 | if (res < 0) | 729 | if (res < 0) |
730 | goto outerr; | 730 | goto outerr; |
731 | 731 | ||
732 | printk(KERN_DEBUG "Bad block table written to 0x%08x, version " | 732 | printk(KERN_DEBUG "Bad block table written to 0x%012llx, version " |
733 | "0x%02X\n", (unsigned int)to, td->version[chip]); | 733 | "0x%02X\n", (unsigned long long)to, td->version[chip]); |
734 | 734 | ||
735 | /* Mark it as used */ | 735 | /* Mark it as used */ |
736 | td->pages[chip] = page; | 736 | td->pages[chip] = page; |
@@ -910,7 +910,7 @@ static void mark_bbt_region(struct mtd_info *mtd, struct nand_bbt_descr *td) | |||
910 | newval = oldval | (0x2 << (block & 0x06)); | 910 | newval = oldval | (0x2 << (block & 0x06)); |
911 | this->bbt[(block >> 3)] = newval; | 911 | this->bbt[(block >> 3)] = newval; |
912 | if ((oldval != newval) && td->reserved_block_code) | 912 | if ((oldval != newval) && td->reserved_block_code) |
913 | nand_update_bbt(mtd, block << (this->bbt_erase_shift - 1)); | 913 | nand_update_bbt(mtd, (loff_t)block << (this->bbt_erase_shift - 1)); |
914 | continue; | 914 | continue; |
915 | } | 915 | } |
916 | update = 0; | 916 | update = 0; |
@@ -931,7 +931,7 @@ static void mark_bbt_region(struct mtd_info *mtd, struct nand_bbt_descr *td) | |||
931 | new ones have been marked, then we need to update the stored | 931 | new ones have been marked, then we need to update the stored |
932 | bbts. This should only happen once. */ | 932 | bbts. This should only happen once. */ |
933 | if (update && td->reserved_block_code) | 933 | if (update && td->reserved_block_code) |
934 | nand_update_bbt(mtd, (block - 2) << (this->bbt_erase_shift - 1)); | 934 | nand_update_bbt(mtd, (loff_t)(block - 2) << (this->bbt_erase_shift - 1)); |
935 | } | 935 | } |
936 | } | 936 | } |
937 | 937 | ||
@@ -1027,7 +1027,6 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs) | |||
1027 | if (!this->bbt || !td) | 1027 | if (!this->bbt || !td) |
1028 | return -EINVAL; | 1028 | return -EINVAL; |
1029 | 1029 | ||
1030 | len = mtd->size >> (this->bbt_erase_shift + 2); | ||
1031 | /* Allocate a temporary buffer for one eraseblock incl. oob */ | 1030 | /* Allocate a temporary buffer for one eraseblock incl. oob */ |
1032 | len = (1 << this->bbt_erase_shift); | 1031 | len = (1 << this->bbt_erase_shift); |
1033 | len += (len >> this->page_shift) * mtd->oobsize; | 1032 | len += (len >> this->page_shift) * mtd->oobsize; |
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c index 320b929abe79..d1c4546513f7 100644 --- a/drivers/mtd/nftlcore.c +++ b/drivers/mtd/nftlcore.c | |||
@@ -39,7 +39,7 @@ static void nftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
39 | struct NFTLrecord *nftl; | 39 | struct NFTLrecord *nftl; |
40 | unsigned long temp; | 40 | unsigned long temp; |
41 | 41 | ||
42 | if (mtd->type != MTD_NANDFLASH) | 42 | if (mtd->type != MTD_NANDFLASH || mtd->size > UINT_MAX) |
43 | return; | 43 | return; |
44 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ | 44 | /* OK, this is moderately ugly. But probably safe. Alternatives? */ |
45 | if (memcmp(mtd->name, "DiskOnChip", 10)) | 45 | if (memcmp(mtd->name, "DiskOnChip", 10)) |
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c index ccc4f209fbb5..8b22b1836e9f 100644 --- a/drivers/mtd/nftlmount.c +++ b/drivers/mtd/nftlmount.c | |||
@@ -51,7 +51,7 @@ static int find_boot_record(struct NFTLrecord *nftl) | |||
51 | the mtd device accordingly. We could even get rid of | 51 | the mtd device accordingly. We could even get rid of |
52 | nftl->EraseSize if there were any point in doing so. */ | 52 | nftl->EraseSize if there were any point in doing so. */ |
53 | nftl->EraseSize = nftl->mbd.mtd->erasesize; | 53 | nftl->EraseSize = nftl->mbd.mtd->erasesize; |
54 | nftl->nb_blocks = nftl->mbd.mtd->size / nftl->EraseSize; | 54 | nftl->nb_blocks = (u32)nftl->mbd.mtd->size / nftl->EraseSize; |
55 | 55 | ||
56 | nftl->MediaUnit = BLOCK_NIL; | 56 | nftl->MediaUnit = BLOCK_NIL; |
57 | nftl->SpareMediaUnit = BLOCK_NIL; | 57 | nftl->SpareMediaUnit = BLOCK_NIL; |
@@ -168,7 +168,7 @@ device is already correct. | |||
168 | printk(KERN_NOTICE "WARNING: Support for NFTL with UnitSizeFactor 0x%02x is experimental\n", | 168 | printk(KERN_NOTICE "WARNING: Support for NFTL with UnitSizeFactor 0x%02x is experimental\n", |
169 | mh->UnitSizeFactor); | 169 | mh->UnitSizeFactor); |
170 | nftl->EraseSize = nftl->mbd.mtd->erasesize << (0xff - mh->UnitSizeFactor); | 170 | nftl->EraseSize = nftl->mbd.mtd->erasesize << (0xff - mh->UnitSizeFactor); |
171 | nftl->nb_blocks = nftl->mbd.mtd->size / nftl->EraseSize; | 171 | nftl->nb_blocks = (u32)nftl->mbd.mtd->size / nftl->EraseSize; |
172 | } | 172 | } |
173 | #endif | 173 | #endif |
174 | nftl->nb_boot_blocks = le16_to_cpu(mh->FirstPhysicalEUN); | 174 | nftl->nb_boot_blocks = le16_to_cpu(mh->FirstPhysicalEUN); |
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 90ed319f26e6..529af271db17 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -1772,7 +1772,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
1772 | int len; | 1772 | int len; |
1773 | int ret = 0; | 1773 | int ret = 0; |
1774 | 1774 | ||
1775 | DEBUG(MTD_DEBUG_LEVEL3, "onenand_erase: start = 0x%08x, len = %i\n", (unsigned int) instr->addr, (unsigned int) instr->len); | 1775 | DEBUG(MTD_DEBUG_LEVEL3, "onenand_erase: start = 0x%012llx, len = %llu\n", (unsigned long long) instr->addr, (unsigned long long) instr->len); |
1776 | 1776 | ||
1777 | block_size = (1 << this->erase_shift); | 1777 | block_size = (1 << this->erase_shift); |
1778 | 1778 | ||
@@ -1810,7 +1810,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
1810 | 1810 | ||
1811 | /* Check if we have a bad block, we do not erase bad blocks */ | 1811 | /* Check if we have a bad block, we do not erase bad blocks */ |
1812 | if (onenand_block_isbad_nolock(mtd, addr, 0)) { | 1812 | if (onenand_block_isbad_nolock(mtd, addr, 0)) { |
1813 | printk (KERN_WARNING "onenand_erase: attempt to erase a bad block at addr 0x%08x\n", (unsigned int) addr); | 1813 | printk (KERN_WARNING "onenand_erase: attempt to erase a bad block at addr 0x%012llx\n", (unsigned long long) addr); |
1814 | instr->state = MTD_ERASE_FAILED; | 1814 | instr->state = MTD_ERASE_FAILED; |
1815 | goto erase_exit; | 1815 | goto erase_exit; |
1816 | } | 1816 | } |
@@ -2029,7 +2029,7 @@ static int onenand_do_lock_cmd(struct mtd_info *mtd, loff_t ofs, size_t len, int | |||
2029 | * | 2029 | * |
2030 | * Lock one or more blocks | 2030 | * Lock one or more blocks |
2031 | */ | 2031 | */ |
2032 | static int onenand_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | 2032 | static int onenand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
2033 | { | 2033 | { |
2034 | int ret; | 2034 | int ret; |
2035 | 2035 | ||
@@ -2047,7 +2047,7 @@ static int onenand_lock(struct mtd_info *mtd, loff_t ofs, size_t len) | |||
2047 | * | 2047 | * |
2048 | * Unlock one or more blocks | 2048 | * Unlock one or more blocks |
2049 | */ | 2049 | */ |
2050 | static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) | 2050 | static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
2051 | { | 2051 | { |
2052 | int ret; | 2052 | int ret; |
2053 | 2053 | ||
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c index e538c0a72abb..490b4742ce3a 100644 --- a/drivers/mtd/rfd_ftl.c +++ b/drivers/mtd/rfd_ftl.c | |||
@@ -156,7 +156,7 @@ static int scan_header(struct partition *part) | |||
156 | size_t retlen; | 156 | size_t retlen; |
157 | 157 | ||
158 | sectors_per_block = part->block_size / SECTOR_SIZE; | 158 | sectors_per_block = part->block_size / SECTOR_SIZE; |
159 | part->total_blocks = part->mbd.mtd->size / part->block_size; | 159 | part->total_blocks = (u32)part->mbd.mtd->size / part->block_size; |
160 | 160 | ||
161 | if (part->total_blocks < 2) | 161 | if (part->total_blocks < 2) |
162 | return -ENOENT; | 162 | return -ENOENT; |
@@ -276,16 +276,17 @@ static void erase_callback(struct erase_info *erase) | |||
276 | 276 | ||
277 | part = (struct partition*)erase->priv; | 277 | part = (struct partition*)erase->priv; |
278 | 278 | ||
279 | i = erase->addr / part->block_size; | 279 | i = (u32)erase->addr / part->block_size; |
280 | if (i >= part->total_blocks || part->blocks[i].offset != erase->addr) { | 280 | if (i >= part->total_blocks || part->blocks[i].offset != erase->addr || |
281 | printk(KERN_ERR PREFIX "erase callback for unknown offset %x " | 281 | erase->addr > UINT_MAX) { |
282 | "on '%s'\n", erase->addr, part->mbd.mtd->name); | 282 | printk(KERN_ERR PREFIX "erase callback for unknown offset %llx " |
283 | "on '%s'\n", (unsigned long long)erase->addr, part->mbd.mtd->name); | ||
283 | return; | 284 | return; |
284 | } | 285 | } |
285 | 286 | ||
286 | if (erase->state != MTD_ERASE_DONE) { | 287 | if (erase->state != MTD_ERASE_DONE) { |
287 | printk(KERN_WARNING PREFIX "erase failed at 0x%x on '%s', " | 288 | printk(KERN_WARNING PREFIX "erase failed at 0x%llx on '%s', " |
288 | "state %d\n", erase->addr, | 289 | "state %d\n", (unsigned long long)erase->addr, |
289 | part->mbd.mtd->name, erase->state); | 290 | part->mbd.mtd->name, erase->state); |
290 | 291 | ||
291 | part->blocks[i].state = BLOCK_FAILED; | 292 | part->blocks[i].state = BLOCK_FAILED; |
@@ -345,9 +346,9 @@ static int erase_block(struct partition *part, int block) | |||
345 | rc = part->mbd.mtd->erase(part->mbd.mtd, erase); | 346 | rc = part->mbd.mtd->erase(part->mbd.mtd, erase); |
346 | 347 | ||
347 | if (rc) { | 348 | if (rc) { |
348 | printk(KERN_ERR PREFIX "erase of region %x,%x on '%s' " | 349 | printk(KERN_ERR PREFIX "erase of region %llx,%llx on '%s' " |
349 | "failed\n", erase->addr, erase->len, | 350 | "failed\n", (unsigned long long)erase->addr, |
350 | part->mbd.mtd->name); | 351 | (unsigned long long)erase->len, part->mbd.mtd->name); |
351 | kfree(erase); | 352 | kfree(erase); |
352 | } | 353 | } |
353 | 354 | ||
@@ -763,7 +764,7 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
763 | { | 764 | { |
764 | struct partition *part; | 765 | struct partition *part; |
765 | 766 | ||
766 | if (mtd->type != MTD_NORFLASH) | 767 | if (mtd->type != MTD_NORFLASH || mtd->size > UINT_MAX) |
767 | return; | 768 | return; |
768 | 769 | ||
769 | part = kzalloc(sizeof(struct partition), GFP_KERNEL); | 770 | part = kzalloc(sizeof(struct partition), GFP_KERNEL); |
diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c index 33a5d6ed6f18..3f67e00d98e0 100644 --- a/drivers/mtd/ssfdc.c +++ b/drivers/mtd/ssfdc.c | |||
@@ -294,7 +294,8 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
294 | int cis_sector; | 294 | int cis_sector; |
295 | 295 | ||
296 | /* Check for small page NAND flash */ | 296 | /* Check for small page NAND flash */ |
297 | if (mtd->type != MTD_NANDFLASH || mtd->oobsize != OOB_SIZE) | 297 | if (mtd->type != MTD_NANDFLASH || mtd->oobsize != OOB_SIZE || |
298 | mtd->size > UINT_MAX) | ||
298 | return; | 299 | return; |
299 | 300 | ||
300 | /* Check for SSDFC format by reading CIS/IDI sector */ | 301 | /* Check for SSDFC format by reading CIS/IDI sector */ |
@@ -316,7 +317,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
316 | 317 | ||
317 | ssfdc->cis_block = cis_sector / (mtd->erasesize >> SECTOR_SHIFT); | 318 | ssfdc->cis_block = cis_sector / (mtd->erasesize >> SECTOR_SHIFT); |
318 | ssfdc->erase_size = mtd->erasesize; | 319 | ssfdc->erase_size = mtd->erasesize; |
319 | ssfdc->map_len = mtd->size / mtd->erasesize; | 320 | ssfdc->map_len = (u32)mtd->size / mtd->erasesize; |
320 | 321 | ||
321 | DEBUG(MTD_DEBUG_LEVEL1, | 322 | DEBUG(MTD_DEBUG_LEVEL1, |
322 | "SSFDC_RO: cis_block=%d,erase_size=%d,map_len=%d,n_zones=%d\n", | 323 | "SSFDC_RO: cis_block=%d,erase_size=%d,map_len=%d,n_zones=%d\n", |
@@ -327,7 +328,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
327 | ssfdc->heads = 16; | 328 | ssfdc->heads = 16; |
328 | ssfdc->sectors = 32; | 329 | ssfdc->sectors = 32; |
329 | get_chs(mtd->size, NULL, &ssfdc->heads, &ssfdc->sectors); | 330 | get_chs(mtd->size, NULL, &ssfdc->heads, &ssfdc->sectors); |
330 | ssfdc->cylinders = (unsigned short)((mtd->size >> SECTOR_SHIFT) / | 331 | ssfdc->cylinders = (unsigned short)(((u32)mtd->size >> SECTOR_SHIFT) / |
331 | ((long)ssfdc->sectors * (long)ssfdc->heads)); | 332 | ((long)ssfdc->sectors * (long)ssfdc->heads)); |
332 | 333 | ||
333 | DEBUG(MTD_DEBUG_LEVEL1, "SSFDC_RO: using C:%d H:%d S:%d == %ld sects\n", | 334 | DEBUG(MTD_DEBUG_LEVEL1, "SSFDC_RO: using C:%d H:%d S:%d == %ld sects\n", |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index c7630a228310..634e2e86525f 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -561,7 +561,7 @@ static int io_init(struct ubi_device *ubi) | |||
561 | */ | 561 | */ |
562 | 562 | ||
563 | ubi->peb_size = ubi->mtd->erasesize; | 563 | ubi->peb_size = ubi->mtd->erasesize; |
564 | ubi->peb_count = ubi->mtd->size / ubi->mtd->erasesize; | 564 | ubi->peb_count = mtd_div_by_eb(ubi->mtd->size, ubi->mtd); |
565 | ubi->flash_size = ubi->mtd->size; | 565 | ubi->flash_size = ubi->mtd->size; |
566 | 566 | ||
567 | if (ubi->mtd->block_isbad && ubi->mtd->block_markbad) | 567 | if (ubi->mtd->block_isbad && ubi->mtd->block_markbad) |
diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c index 605812bb0b1a..6dd4f5e77f82 100644 --- a/drivers/mtd/ubi/gluebi.c +++ b/drivers/mtd/ubi/gluebi.c | |||
@@ -215,7 +215,8 @@ static int gluebi_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
215 | struct ubi_volume *vol; | 215 | struct ubi_volume *vol; |
216 | struct ubi_device *ubi; | 216 | struct ubi_device *ubi; |
217 | 217 | ||
218 | dbg_gen("erase %u bytes at offset %u", instr->len, instr->addr); | 218 | dbg_gen("erase %llu bytes at offset %llu", (unsigned long long)instr->len, |
219 | (unsigned long long)instr->addr); | ||
219 | 220 | ||
220 | if (instr->addr < 0 || instr->addr > mtd->size - mtd->erasesize) | 221 | if (instr->addr < 0 || instr->addr > mtd->size - mtd->erasesize) |
221 | return -EINVAL; | 222 | return -EINVAL; |
@@ -223,11 +224,11 @@ static int gluebi_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
223 | if (instr->len < 0 || instr->addr + instr->len > mtd->size) | 224 | if (instr->len < 0 || instr->addr + instr->len > mtd->size) |
224 | return -EINVAL; | 225 | return -EINVAL; |
225 | 226 | ||
226 | if (instr->addr % mtd->writesize || instr->len % mtd->writesize) | 227 | if (mtd_mod_by_ws(instr->addr, mtd) || mtd_mod_by_ws(instr->len, mtd)) |
227 | return -EINVAL; | 228 | return -EINVAL; |
228 | 229 | ||
229 | lnum = instr->addr / mtd->erasesize; | 230 | lnum = mtd_div_by_eb(instr->addr, mtd); |
230 | count = instr->len / mtd->erasesize; | 231 | count = mtd_div_by_eb(instr->len, mtd); |
231 | 232 | ||
232 | vol = container_of(mtd, struct ubi_volume, gluebi_mtd); | 233 | vol = container_of(mtd, struct ubi_volume, gluebi_mtd); |
233 | ubi = vol->ubi; | 234 | ubi = vol->ubi; |
@@ -255,7 +256,7 @@ static int gluebi_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
255 | 256 | ||
256 | out_err: | 257 | out_err: |
257 | instr->state = MTD_ERASE_FAILED; | 258 | instr->state = MTD_ERASE_FAILED; |
258 | instr->fail_addr = lnum * mtd->erasesize; | 259 | instr->fail_addr = (long long)lnum * mtd->erasesize; |
259 | return err; | 260 | return err; |
260 | } | 261 | } |
261 | 262 | ||
@@ -294,7 +295,7 @@ int ubi_create_gluebi(struct ubi_device *ubi, struct ubi_volume *vol) | |||
294 | * bytes. | 295 | * bytes. |
295 | */ | 296 | */ |
296 | if (vol->vol_type == UBI_DYNAMIC_VOLUME) | 297 | if (vol->vol_type == UBI_DYNAMIC_VOLUME) |
297 | mtd->size = vol->usable_leb_size * vol->reserved_pebs; | 298 | mtd->size = (long long)vol->usable_leb_size * vol->reserved_pebs; |
298 | else | 299 | else |
299 | mtd->size = vol->used_bytes; | 300 | mtd->size = vol->used_bytes; |
300 | 301 | ||
@@ -304,8 +305,8 @@ int ubi_create_gluebi(struct ubi_device *ubi, struct ubi_volume *vol) | |||
304 | return -ENFILE; | 305 | return -ENFILE; |
305 | } | 306 | } |
306 | 307 | ||
307 | dbg_gen("added mtd%d (\"%s\"), size %u, EB size %u", | 308 | dbg_gen("added mtd%d (\"%s\"), size %llu, EB size %u", |
308 | mtd->index, mtd->name, mtd->size, mtd->erasesize); | 309 | mtd->index, mtd->name, (unsigned long long)mtd->size, mtd->erasesize); |
309 | return 0; | 310 | return 0; |
310 | } | 311 | } |
311 | 312 | ||