diff options
Diffstat (limited to 'drivers/mtd/devices/lart.c')
-rw-r--r-- | drivers/mtd/devices/lart.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c index 3a11ea628e58..82bd00af5cc3 100644 --- a/drivers/mtd/devices/lart.c +++ b/drivers/mtd/devices/lart.c | |||
@@ -367,9 +367,6 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr) | |||
367 | printk (KERN_DEBUG "%s(addr = 0x%.8x, len = %d)\n", __func__, instr->addr, instr->len); | 367 | printk (KERN_DEBUG "%s(addr = 0x%.8x, len = %d)\n", __func__, instr->addr, instr->len); |
368 | #endif | 368 | #endif |
369 | 369 | ||
370 | /* sanity checks */ | ||
371 | if (instr->addr + instr->len > mtd->size) return (-EINVAL); | ||
372 | |||
373 | /* | 370 | /* |
374 | * check that both start and end of the requested erase are | 371 | * check that both start and end of the requested erase are |
375 | * aligned with the erasesize at the appropriate addresses. | 372 | * aligned with the erasesize at the appropriate addresses. |
@@ -440,10 +437,6 @@ static int flash_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retle | |||
440 | printk (KERN_DEBUG "%s(from = 0x%.8x, len = %d)\n", __func__, (__u32)from, len); | 437 | printk (KERN_DEBUG "%s(from = 0x%.8x, len = %d)\n", __func__, (__u32)from, len); |
441 | #endif | 438 | #endif |
442 | 439 | ||
443 | /* sanity checks */ | ||
444 | if (!len) return (0); | ||
445 | if (from + len > mtd->size) return (-EINVAL); | ||
446 | |||
447 | /* we always read len bytes */ | 440 | /* we always read len bytes */ |
448 | *retlen = len; | 441 | *retlen = len; |
449 | 442 | ||
@@ -522,11 +515,8 @@ static int flash_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen | |||
522 | printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n", __func__, (__u32)to, len); | 515 | printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n", __func__, (__u32)to, len); |
523 | #endif | 516 | #endif |
524 | 517 | ||
525 | *retlen = 0; | ||
526 | |||
527 | /* sanity checks */ | 518 | /* sanity checks */ |
528 | if (!len) return (0); | 519 | if (!len) return (0); |
529 | if (to + len > mtd->size) return (-EINVAL); | ||
530 | 520 | ||
531 | /* first, we write a 0xFF.... padded byte until we reach a dword boundary */ | 521 | /* first, we write a 0xFF.... padded byte until we reach a dword boundary */ |
532 | if (to & (BUSWIDTH - 1)) | 522 | if (to & (BUSWIDTH - 1)) |
@@ -630,14 +620,15 @@ static int __init lart_flash_init (void) | |||
630 | mtd.name = module_name; | 620 | mtd.name = module_name; |
631 | mtd.type = MTD_NORFLASH; | 621 | mtd.type = MTD_NORFLASH; |
632 | mtd.writesize = 1; | 622 | mtd.writesize = 1; |
623 | mtd.writebufsize = 4; | ||
633 | mtd.flags = MTD_CAP_NORFLASH; | 624 | mtd.flags = MTD_CAP_NORFLASH; |
634 | mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN; | 625 | mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN; |
635 | mtd.erasesize = FLASH_BLOCKSIZE_MAIN; | 626 | mtd.erasesize = FLASH_BLOCKSIZE_MAIN; |
636 | mtd.numeraseregions = ARRAY_SIZE(erase_regions); | 627 | mtd.numeraseregions = ARRAY_SIZE(erase_regions); |
637 | mtd.eraseregions = erase_regions; | 628 | mtd.eraseregions = erase_regions; |
638 | mtd.erase = flash_erase; | 629 | mtd._erase = flash_erase; |
639 | mtd.read = flash_read; | 630 | mtd._read = flash_read; |
640 | mtd.write = flash_write; | 631 | mtd._write = flash_write; |
641 | mtd.owner = THIS_MODULE; | 632 | mtd.owner = THIS_MODULE; |
642 | 633 | ||
643 | #ifdef LART_DEBUG | 634 | #ifdef LART_DEBUG |