From 1ee640765a71a7b9ee2cf4ebad22ed5961aef8db Mon Sep 17 00:00:00 2001 From: Dmitry Lavnikevich Date: Mon, 10 Mar 2014 14:39:49 +0300 Subject: 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. 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 (mtd_div_by_wb, mtd_div_by_eb may be used in some of such cases). Was tested on phyFLEX i.MX6. Signed-off-by: Dmitry Lavnikevich Signed-off-by: Grigory Milev Signed-off-by: Sascha Hauer --- drivers/mtd/devices/m25p80.c | 5 +++-- drivers/mtd/devices/mtd_dataflash.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/mtd/devices') diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 56c69f35c0..50e04548e9 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -268,8 +268,9 @@ static int erase_sector(struct m25p *flash, u32 offset, u32 command) static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr) { struct m25p *flash = mtd_to_m25p(mtd); - u32 addr, len; + u32 addr; uint32_t rem; + uint64_t len; dev_dbg(&flash->spi->dev, "%s at 0x%llx, len %lld\n", __func__, (long long)instr->addr, @@ -897,7 +898,7 @@ static int m25p_probe(struct device_d *dev) flash->mtd.type = MTD_NORFLASH; flash->mtd.writesize = 1; flash->mtd.flags = MTD_CAP_NORFLASH; - flash->mtd.size = info->sector_size * info->n_sectors; + flash->mtd.size = (uint64_t)info->sector_size * info->n_sectors; flash->mtd.erase = m25p80_erase; flash->mtd.read = m25p80_read; diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index cdc0120c53..fa31b61464 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -625,7 +625,7 @@ add_dataflash_otp(struct spi_device *spi, char *name, device = &priv->mtd; device->name = (pdata && pdata->name) ? pdata->name : "dataflash"; - device->size = nr_pages * pagesize; + device->size = nr_pages * (uint64_t)pagesize; device->erasesize = pagesize; device->writesize = pagesize; device->type = MTD_DATAFLASH; -- cgit v1.2.3