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 /drivers/mtd/devices | |
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>
Diffstat (limited to 'drivers/mtd/devices')
-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 |
10 files changed, 0 insertions, 39 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 4c2f84c2a7c7..ba2d74b01c7e 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -104,9 +104,6 @@ static int block2mtd_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
104 | int offset = from & (PAGE_SIZE-1); | 104 | int offset = from & (PAGE_SIZE-1); |
105 | int cpylen; | 105 | int cpylen; |
106 | 106 | ||
107 | if (retlen) | ||
108 | *retlen = 0; | ||
109 | |||
110 | while (len) { | 107 | while (len) { |
111 | if ((offset + len) > PAGE_SIZE) | 108 | if ((offset + len) > PAGE_SIZE) |
112 | cpylen = PAGE_SIZE - offset; // multiple pages | 109 | cpylen = PAGE_SIZE - offset; // multiple pages |
@@ -143,8 +140,6 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf, | |||
143 | int offset = to & ~PAGE_MASK; // page offset | 140 | int offset = to & ~PAGE_MASK; // page offset |
144 | int cpylen; | 141 | int cpylen; |
145 | 142 | ||
146 | if (retlen) | ||
147 | *retlen = 0; | ||
148 | while (len) { | 143 | while (len) { |
149 | if ((offset+len) > PAGE_SIZE) | 144 | if ((offset+len) > PAGE_SIZE) |
150 | cpylen = PAGE_SIZE - offset; // multiple pages | 145 | cpylen = PAGE_SIZE - offset; // multiple pages |
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index ee4ee0b8440d..7ad7b054800c 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -603,8 +603,6 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
603 | size_t left = len; | 603 | size_t left = len; |
604 | 604 | ||
605 | mutex_lock(&this->lock); | 605 | mutex_lock(&this->lock); |
606 | |||
607 | *retlen = 0; | ||
608 | while (left) { | 606 | while (left) { |
609 | len = left; | 607 | len = left; |
610 | 608 | ||
@@ -745,8 +743,6 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
745 | int status; | 743 | int status; |
746 | 744 | ||
747 | mutex_lock(&this->lock); | 745 | mutex_lock(&this->lock); |
748 | |||
749 | *retlen = 0; | ||
750 | while (left) { | 746 | while (left) { |
751 | len = left; | 747 | len = left; |
752 | 748 | ||
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c index 17844155a685..7bff54e62cd5 100644 --- a/drivers/mtd/devices/doc2001.c +++ b/drivers/mtd/devices/doc2001.c | |||
@@ -591,7 +591,6 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len, | |||
591 | printk("Error programming flash\n"); | 591 | printk("Error programming flash\n"); |
592 | /* Error in programming | 592 | /* Error in programming |
593 | FIXME: implement Bad Block Replacement (in nftl.c ??) */ | 593 | FIXME: implement Bad Block Replacement (in nftl.c ??) */ |
594 | *retlen = 0; | ||
595 | ret = -EIO; | 594 | ret = -EIO; |
596 | } | 595 | } |
597 | dummy = ReadDOC(docptr, LastDataRead); | 596 | dummy = ReadDOC(docptr, LastDataRead); |
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c index a472bab7ef2b..4a03d869ad03 100644 --- a/drivers/mtd/devices/doc2001plus.c +++ b/drivers/mtd/devices/doc2001plus.c | |||
@@ -792,7 +792,6 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
792 | printk("MTD: Error 0x%x programming at 0x%x\n", dummy, (int)to); | 792 | printk("MTD: Error 0x%x programming at 0x%x\n", dummy, (int)to); |
793 | /* Error in programming | 793 | /* Error in programming |
794 | FIXME: implement Bad Block Replacement (in nftl.c ??) */ | 794 | FIXME: implement Bad Block Replacement (in nftl.c ??) */ |
795 | *retlen = 0; | ||
796 | ret = -EIO; | 795 | ret = -EIO; |
797 | } | 796 | } |
798 | dummy = ReadDOC(docptr, Mplus_LastDataRead); | 797 | dummy = ReadDOC(docptr, Mplus_LastDataRead); |
diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c index c9ae60112a90..6fb8dba76959 100644 --- a/drivers/mtd/devices/lart.c +++ b/drivers/mtd/devices/lart.c | |||
@@ -518,8 +518,6 @@ static int flash_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen | |||
518 | printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n", __func__, (__u32)to, len); | 518 | printk (KERN_DEBUG "%s(to = 0x%.8x, len = %d)\n", __func__, (__u32)to, len); |
519 | #endif | 519 | #endif |
520 | 520 | ||
521 | *retlen = 0; | ||
522 | |||
523 | /* sanity checks */ | 521 | /* sanity checks */ |
524 | if (!len) return (0); | 522 | if (!len) return (0); |
525 | 523 | ||
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 0955a8f4fd25..45cc4a1ae5b0 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -365,9 +365,6 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
365 | t[1].len = len; | 365 | t[1].len = len; |
366 | spi_message_add_tail(&t[1], &m); | 366 | spi_message_add_tail(&t[1], &m); |
367 | 367 | ||
368 | /* Byte count starts at zero. */ | ||
369 | *retlen = 0; | ||
370 | |||
371 | mutex_lock(&flash->lock); | 368 | mutex_lock(&flash->lock); |
372 | 369 | ||
373 | /* Wait till previous write/erase is done. */ | 370 | /* Wait till previous write/erase is done. */ |
@@ -411,8 +408,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
411 | pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev), | 408 | pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev), |
412 | __func__, (u32)to, len); | 409 | __func__, (u32)to, len); |
413 | 410 | ||
414 | *retlen = 0; | ||
415 | |||
416 | /* sanity checks */ | 411 | /* sanity checks */ |
417 | if (!len) | 412 | if (!len) |
418 | return(0); | 413 | return(0); |
@@ -500,8 +495,6 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
500 | pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev), | 495 | pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev), |
501 | __func__, (u32)to, len); | 496 | __func__, (u32)to, len); |
502 | 497 | ||
503 | *retlen = 0; | ||
504 | |||
505 | /* sanity checks */ | 498 | /* sanity checks */ |
506 | if (!len) | 499 | if (!len) |
507 | return 0; | 500 | return 0; |
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index fc5c78171844..c76b4464e8b9 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c | |||
@@ -249,8 +249,6 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
249 | pr_debug("%s: read 0x%x..0x%x\n", dev_name(&priv->spi->dev), | 249 | pr_debug("%s: read 0x%x..0x%x\n", dev_name(&priv->spi->dev), |
250 | (unsigned)from, (unsigned)(from + len)); | 250 | (unsigned)from, (unsigned)(from + len)); |
251 | 251 | ||
252 | *retlen = 0; | ||
253 | |||
254 | /* Sanity checks */ | 252 | /* Sanity checks */ |
255 | if (!len) | 253 | if (!len) |
256 | return 0; | 254 | return 0; |
@@ -323,8 +321,6 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
323 | pr_debug("%s: write 0x%x..0x%x\n", | 321 | pr_debug("%s: write 0x%x..0x%x\n", |
324 | dev_name(&spi->dev), (unsigned)to, (unsigned)(to + len)); | 322 | dev_name(&spi->dev), (unsigned)to, (unsigned)(to + len)); |
325 | 323 | ||
326 | *retlen = 0; | ||
327 | |||
328 | /* Sanity checks */ | 324 | /* Sanity checks */ |
329 | if (!len) | 325 | if (!len) |
330 | return 0; | 326 | return 0; |
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index d0e8dc69fe1c..d3474a48d097 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c | |||
@@ -85,8 +85,6 @@ static int phram_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | |||
89 | |||
90 | static void unregister_devices(void) | 88 | static void unregister_devices(void) |
91 | { | 89 | { |
92 | struct phram_mtd_list *this, *safe; | 90 | struct phram_mtd_list *this, *safe; |
diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index 2238ab916a06..2cdbcc65b39f 100644 --- a/drivers/mtd/devices/spear_smi.c +++ b/drivers/mtd/devices/spear_smi.c | |||
@@ -574,11 +574,6 @@ static int spear_mtd_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
574 | return -EINVAL; | 574 | return -EINVAL; |
575 | } | 575 | } |
576 | 576 | ||
577 | if (!retlen) | ||
578 | return -EINVAL; | ||
579 | else | ||
580 | *retlen = 0; | ||
581 | |||
582 | /* select address as per bank number */ | 577 | /* select address as per bank number */ |
583 | src = flash->base_addr + from; | 578 | src = flash->base_addr + from; |
584 | 579 | ||
@@ -675,11 +670,6 @@ static int spear_mtd_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
675 | return -EINVAL; | 670 | return -EINVAL; |
676 | } | 671 | } |
677 | 672 | ||
678 | if (!retlen) | ||
679 | return -EINVAL; | ||
680 | else | ||
681 | *retlen = 0; | ||
682 | |||
683 | /* select address as per bank number */ | 673 | /* select address as per bank number */ |
684 | dest = flash->base_addr + to; | 674 | dest = flash->base_addr + to; |
685 | mutex_lock(&flash->lock); | 675 | mutex_lock(&flash->lock); |
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c index 99d4a3c510d7..5c2613c99e4a 100644 --- a/drivers/mtd/devices/sst25l.c +++ b/drivers/mtd/devices/sst25l.c | |||
@@ -224,9 +224,6 @@ static int sst25l_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
224 | if (len == 0) | 224 | if (len == 0) |
225 | return 0; | 225 | return 0; |
226 | 226 | ||
227 | if (retlen) | ||
228 | *retlen = 0; | ||
229 | |||
230 | spi_message_init(&message); | 227 | spi_message_init(&message); |
231 | memset(&transfer, 0, sizeof(transfer)); | 228 | memset(&transfer, 0, sizeof(transfer)); |
232 | 229 | ||