diff options
author | Adrian Hunter <ext-adrian.hunter@nokia.com> | 2008-12-10 08:37:21 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-12-10 08:37:21 -0500 |
commit | 69423d99fc182a81f3c5db3eb5c140acc6fc64be (patch) | |
tree | 5f1818e6fb69388f0da276152646bf0597e318c0 /drivers/mtd/maps | |
parent | 8a4c2495b142fe612b291a810d9e695f269c26db (diff) |
[MTD] update internal API to support 64-bit device size
MTD internal API presently uses 32-bit values to represent
device size. This patch updates them to 64-bits but leaves
the external API unchanged. Extending the external API
is a separate issue for several reasons. First, no one
needs it at the moment. Secondly, whether the implementation
is done with IOCTLs, sysfs or both is still debated. Thirdly
external API changes require the internal API to be accepted
first.
Note that although the MTD API will be able to support 64-bit
device sizes, existing drivers do not and are not required
to do so, although NAND base has been updated.
In general, changing from 32-bit to 64-bit values cause little
or no changes to the majority of the code with the following
exceptions:
- printk message formats
- division and modulus of 64-bit values
- NAND base support
- 32-bit local variables used by mtdpart and mtdconcat
- naughtily assuming one structure maps to another
in MEMERASE ioctl
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/maps')
-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 |
6 files changed, 14 insertions, 12 deletions
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 | ||