diff options
| author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-02-06 05:39:07 -0500 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-26 19:29:34 -0400 |
| commit | 834247ec7e281dee839fe4a04bc1bbf0c7395172 (patch) | |
| tree | c037c578ba572d9104a2341013acde044a8ca052 | |
| parent | 664addc248d2fed68d013d26ff2fc796d7134259 (diff) | |
mtd: remove retlen zeroing duplication
The MTD API function now zero the 'retlen' parameter before calling
the driver's method — do not do this again in drivers. This removes
duplicated '*retlen = 0' assignent from the following methods:
'mtd_point()'
'mtd_read()'
'mtd_write()'
'mtd_writev()'
'mtd_panic_write()'
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| -rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 5 | ||||
| -rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 12 | ||||
| -rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0020.c | 3 | ||||
| -rw-r--r-- | drivers/mtd/chips/map_absent.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/devices/block2mtd.c | 5 | ||||
| -rw-r--r-- | drivers/mtd/devices/doc2000.c | 4 | ||||
| -rw-r--r-- | drivers/mtd/devices/doc2001.c | 1 | ||||
| -rw-r--r-- | drivers/mtd/devices/doc2001plus.c | 1 | ||||
| -rw-r--r-- | drivers/mtd/devices/lart.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/devices/m25p80.c | 7 | ||||
| -rw-r--r-- | drivers/mtd/devices/mtd_dataflash.c | 4 | ||||
| -rw-r--r-- | drivers/mtd/devices/phram.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/devices/spear_smi.c | 10 | ||||
| -rw-r--r-- | drivers/mtd/devices/sst25l.c | 3 | ||||
| -rw-r--r-- | drivers/mtd/lpddr/lpddr_cmds.c | 3 | ||||
| -rw-r--r-- | drivers/mtd/mtdconcat.c | 6 | ||||
| -rw-r--r-- | drivers/mtd/mtdcore.c | 1 | ||||
| -rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 3 |
18 files changed, 1 insertions, 73 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 27008ae8f695..dc66df6ab58a 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
| @@ -1334,7 +1334,6 @@ static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 1334 | ofs = from - (chipnum << cfi->chipshift); | 1334 | ofs = from - (chipnum << cfi->chipshift); |
| 1335 | 1335 | ||
| 1336 | *virt = map->virt + cfi->chips[chipnum].start + ofs; | 1336 | *virt = map->virt + cfi->chips[chipnum].start + ofs; |
| 1337 | *retlen = 0; | ||
| 1338 | if (phys) | 1337 | if (phys) |
| 1339 | *phys = map->phys + cfi->chips[chipnum].start + ofs; | 1338 | *phys = map->phys + cfi->chips[chipnum].start + ofs; |
| 1340 | 1339 | ||
| @@ -1460,8 +1459,6 @@ static int cfi_intelext_read (struct mtd_info *mtd, loff_t from, size_t len, siz | |||
| 1460 | chipnum = (from >> cfi->chipshift); | 1459 | chipnum = (from >> cfi->chipshift); |
| 1461 | ofs = from - (chipnum << cfi->chipshift); | 1460 | ofs = from - (chipnum << cfi->chipshift); |
| 1462 | 1461 | ||
| 1463 | *retlen = 0; | ||
| 1464 | |||
| 1465 | while (len) { | 1462 | while (len) { |
| 1466 | unsigned long thislen; | 1463 | unsigned long thislen; |
| 1467 | 1464 | ||
| @@ -1569,7 +1566,6 @@ static int cfi_intelext_write_words (struct mtd_info *mtd, loff_t to , size_t le | |||
| 1569 | int chipnum; | 1566 | int chipnum; |
| 1570 | unsigned long ofs; | 1567 | unsigned long ofs; |
| 1571 | 1568 | ||
| 1572 | *retlen = 0; | ||
| 1573 | if (!len) | 1569 | if (!len) |
| 1574 | return 0; | 1570 | return 0; |
| 1575 | 1571 | ||
| @@ -1817,7 +1813,6 @@ static int cfi_intelext_writev (struct mtd_info *mtd, const struct kvec *vecs, | |||
| 1817 | for (i = 0; i < count; i++) | 1813 | for (i = 0; i < count; i++) |
| 1818 | len += vecs[i].iov_len; | 1814 | len += vecs[i].iov_len; |
| 1819 | 1815 | ||
| 1820 | *retlen = 0; | ||
| 1821 | if (!len) | 1816 | if (!len) |
| 1822 | return 0; | 1817 | return 0; |
| 1823 | 1818 | ||
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 27ac0622abe3..a89d899efad4 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
| @@ -1017,13 +1017,9 @@ static int cfi_amdstd_read (struct mtd_info *mtd, loff_t from, size_t len, size_ | |||
| 1017 | int ret = 0; | 1017 | int ret = 0; |
| 1018 | 1018 | ||
| 1019 | /* ofs: offset within the first chip that the first read should start */ | 1019 | /* ofs: offset within the first chip that the first read should start */ |
| 1020 | |||
| 1021 | chipnum = (from >> cfi->chipshift); | 1020 | chipnum = (from >> cfi->chipshift); |
| 1022 | ofs = from - (chipnum << cfi->chipshift); | 1021 | ofs = from - (chipnum << cfi->chipshift); |
| 1023 | 1022 | ||
| 1024 | |||
| 1025 | *retlen = 0; | ||
| 1026 | |||
| 1027 | while (len) { | 1023 | while (len) { |
| 1028 | unsigned long thislen; | 1024 | unsigned long thislen; |
| 1029 | 1025 | ||
| @@ -1101,16 +1097,11 @@ static int cfi_amdstd_secsi_read (struct mtd_info *mtd, loff_t from, size_t len, | |||
| 1101 | int chipnum; | 1097 | int chipnum; |
| 1102 | int ret = 0; | 1098 | int ret = 0; |
| 1103 | 1099 | ||
| 1104 | |||
| 1105 | /* ofs: offset within the first chip that the first read should start */ | 1100 | /* ofs: offset within the first chip that the first read should start */ |
| 1106 | |||
| 1107 | /* 8 secsi bytes per chip */ | 1101 | /* 8 secsi bytes per chip */ |
| 1108 | chipnum=from>>3; | 1102 | chipnum=from>>3; |
| 1109 | ofs=from & 7; | 1103 | ofs=from & 7; |
| 1110 | 1104 | ||
| 1111 | |||
| 1112 | *retlen = 0; | ||
| 1113 | |||
| 1114 | while (len) { | 1105 | while (len) { |
| 1115 | unsigned long thislen; | 1106 | unsigned long thislen; |
| 1116 | 1107 | ||
| @@ -1255,7 +1246,6 @@ static int cfi_amdstd_write_words(struct mtd_info *mtd, loff_t to, size_t len, | |||
| 1255 | unsigned long ofs, chipstart; | 1246 | unsigned long ofs, chipstart; |
| 1256 | DECLARE_WAITQUEUE(wait, current); | 1247 | DECLARE_WAITQUEUE(wait, current); |
| 1257 | 1248 | ||
| 1258 | *retlen = 0; | ||
| 1259 | if (!len) | 1249 | if (!len) |
| 1260 | return 0; | 1250 | return 0; |
| 1261 | 1251 | ||
| @@ -1497,7 +1487,6 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len, | |||
| 1497 | int chipnum; | 1487 | int chipnum; |
| 1498 | unsigned long ofs; | 1488 | unsigned long ofs; |
| 1499 | 1489 | ||
| 1500 | *retlen = 0; | ||
| 1501 | if (!len) | 1490 | if (!len) |
| 1502 | return 0; | 1491 | return 0; |
| 1503 | 1492 | ||
| @@ -1708,7 +1697,6 @@ static int cfi_amdstd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
| 1708 | int ret = 0; | 1697 | int ret = 0; |
| 1709 | int chipnum; | 1698 | int chipnum; |
| 1710 | 1699 | ||
| 1711 | *retlen = 0; | ||
| 1712 | if (!len) | 1700 | if (!len) |
| 1713 | return 0; | 1701 | return 0; |
| 1714 | 1702 | ||
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c index 160402fb65d1..d690b7d6952b 100644 --- a/drivers/mtd/chips/cfi_cmdset_0020.c +++ b/drivers/mtd/chips/cfi_cmdset_0020.c | |||
| @@ -394,8 +394,6 @@ static int cfi_staa_read (struct mtd_info *mtd, loff_t from, size_t len, size_t | |||
| 394 | chipnum = (from >> cfi->chipshift); | 394 | chipnum = (from >> cfi->chipshift); |
| 395 | ofs = from - (chipnum << cfi->chipshift); | 395 | ofs = from - (chipnum << cfi->chipshift); |
| 396 | 396 | ||
| 397 | *retlen = 0; | ||
| 398 | |||
| 399 | while (len) { | 397 | while (len) { |
| 400 | unsigned long thislen; | 398 | unsigned long thislen; |
| 401 | 399 | ||
| @@ -617,7 +615,6 @@ static int cfi_staa_write_buffers (struct mtd_info *mtd, loff_t to, | |||
| 617 | int chipnum; | 615 | int chipnum; |
| 618 | unsigned long ofs; | 616 | unsigned long ofs; |
| 619 | 617 | ||
| 620 | *retlen = 0; | ||
| 621 | if (!len) | 618 | if (!len) |
| 622 | return 0; | 619 | return 0; |
| 623 | 620 | ||
diff --git a/drivers/mtd/chips/map_absent.c b/drivers/mtd/chips/map_absent.c index 6be2eddfea45..f7a5bca92aef 100644 --- a/drivers/mtd/chips/map_absent.c +++ b/drivers/mtd/chips/map_absent.c | |||
| @@ -70,13 +70,11 @@ static struct mtd_info *map_absent_probe(struct map_info *map) | |||
| 70 | 70 | ||
| 71 | static int map_absent_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) | 71 | static int map_absent_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) |
| 72 | { | 72 | { |
| 73 | *retlen = 0; | ||
| 74 | return -ENODEV; | 73 | return -ENODEV; |
| 75 | } | 74 | } |
| 76 | 75 | ||
| 77 | static int map_absent_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) | 76 | static int map_absent_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) |
| 78 | { | 77 | { |
| 79 | *retlen = 0; | ||
| 80 | return -ENODEV; | 78 | return -ENODEV; |
| 81 | } | 79 | } |
| 82 | |||
