aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-02-06 06:27:43 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:32:19 -0400
commitbcb1d238716d138c9e16347fc32b3c1ae006339e (patch)
treeccb7a9aea7b77481fa3474124218521e0c32de82 /drivers/mtd/chips
parent0dd5235f51fb0eb0b8cef3fed35be39b8a06d7bd (diff)
mtd: move zero length verification to MTD API functions
In many places in drivers we verify for the zero length, but this is very inconsistent across drivers. This is obviously the right thing to do, though. This patch moves the check to the MTD API functions instead and removes a lot of duplication. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c3
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c9
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c3
3 files changed, 0 insertions, 15 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index dc66df6ab58a..2d9669047ed4 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1566,9 +1566,6 @@ static int cfi_intelext_write_words (struct mtd_info *mtd, loff_t to , size_t le
1566 int chipnum; 1566 int chipnum;
1567 unsigned long ofs; 1567 unsigned long ofs;
1568 1568
1569 if (!len)
1570 return 0;
1571
1572 chipnum = to >> cfi->chipshift; 1569 chipnum = to >> cfi->chipshift;
1573 ofs = to - (chipnum << cfi->chipshift); 1570 ofs = to - (chipnum << cfi->chipshift);
1574 1571
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index a89d899efad4..c1d4624ce6e7 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -1246,9 +1246,6 @@ static int cfi_amdstd_write_words(struct mtd_info *mtd, loff_t to, size_t len,
1246 unsigned long ofs, chipstart; 1246 unsigned long ofs, chipstart;
1247 DECLARE_WAITQUEUE(wait, current); 1247 DECLARE_WAITQUEUE(wait, current);
1248 1248
1249 if (!len)
1250 return 0;
1251
1252 chipnum = to >> cfi->chipshift; 1249 chipnum = to >> cfi->chipshift;
1253 ofs = to - (chipnum << cfi->chipshift); 1250 ofs = to - (chipnum << cfi->chipshift);
1254 chipstart = cfi->chips[chipnum].start; 1251 chipstart = cfi->chips[chipnum].start;
@@ -1487,9 +1484,6 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
1487 int chipnum; 1484 int chipnum;
1488 unsigned long ofs; 1485 unsigned long ofs;
1489 1486
1490 if (!len)
1491 return 0;
1492
1493 chipnum = to >> cfi->chipshift; 1487 chipnum = to >> cfi->chipshift;
1494 ofs = to - (chipnum << cfi->chipshift); 1488 ofs = to - (chipnum << cfi->chipshift);
1495 1489
@@ -1697,9 +1691,6 @@ static int cfi_amdstd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
1697 int ret = 0; 1691 int ret = 0;
1698 int chipnum; 1692 int chipnum;
1699 1693
1700 if (!len)
1701 return 0;
1702
1703 chipnum = to >> cfi->chipshift; 1694 chipnum = to >> cfi->chipshift;
1704 ofs = to - (chipnum << cfi->chipshift); 1695 ofs = to - (chipnum << cfi->chipshift);
1705 chipstart = cfi->chips[chipnum].start; 1696 chipstart = cfi->chips[chipnum].start;
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index d690b7d6952b..096993f9711e 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -615,9 +615,6 @@ static int cfi_staa_write_buffers (struct mtd_info *mtd, loff_t to,
615 int chipnum; 615 int chipnum;
616 unsigned long ofs; 616 unsigned long ofs;
617 617
618 if (!len)
619 return 0;
620
621 chipnum = to >> cfi->chipshift; 618 chipnum = to >> cfi->chipshift;
622 ofs = to - (chipnum << cfi->chipshift); 619 ofs = to - (chipnum << cfi->chipshift);
623 620