aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdpart.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-23 11:21:03 -0400
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-23 11:21:03 -0400
commit9223a456da8ed357bf7e0b128c853e2c8bd54614 (patch)
tree50cb225c4ba9c610ae4cb67231b319e78e935ac4 /drivers/mtd/mtdpart.c
parent2528e8cdf376d7da24647c442ec1e88c360d76ca (diff)
[MTD] Remove read/write _ecc variants
MTD clients are agnostic of FLASH which needs ECC suppport. Remove the functions and fixup the callers. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r--drivers/mtd/mtdpart.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index f418920320d2..a93550ce7978 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -55,12 +55,8 @@ static int part_read (struct mtd_info *mtd, loff_t from, size_t len,
55 len = 0; 55 len = 0;
56 else if (from + len > mtd->size) 56 else if (from + len > mtd->size)
57 len = mtd->size - from; 57 len = mtd->size - from;
58 if (part->master->read_ecc == NULL) 58 return part->master->read (part->master, from + part->offset,
59 return part->master->read (part->master, from + part->offset, 59 len, retlen, buf);
60 len, retlen, buf);
61 else
62 return part->master->read_ecc (part->master, from + part->offset,
63 len, retlen, buf, NULL, &mtd->oobinfo);
64} 60}
65 61
66static int part_point (struct mtd_info *mtd, loff_t from, size_t len, 62static int part_point (struct mtd_info *mtd, loff_t from, size_t len,
@@ -74,6 +70,7 @@ static int part_point (struct mtd_info *mtd, loff_t from, size_t len,
74 return part->master->point (part->master, from + part->offset, 70 return part->master->point (part->master, from + part->offset,
75 len, retlen, buf); 71 len, retlen, buf);
76} 72}
73
77static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) 74static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
78{ 75{
79 struct mtd_part *part = PART(mtd); 76 struct mtd_part *part = PART(mtd);
@@ -81,21 +78,6 @@ static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_
81 part->master->unpoint (part->master, addr, from + part->offset, len); 78 part->master->unpoint (part->master, addr, from + part->offset, len);
82} 79}
83 80
84
85static int part_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
86 size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel)
87{
88 struct mtd_part *part = PART(mtd);
89 if (oobsel == NULL)
90 oobsel = &mtd->oobinfo;
91 if (from >= mtd->size)
92 len = 0;
93 else if (from + len > mtd->size)
94 len = mtd->size - from;
95 return part->master->read_ecc (part->master, from + part->offset,
96 len, retlen, buf, eccbuf, oobsel);
97}
98
99static int part_read_oob (struct mtd_info *mtd, loff_t from, size_t len, 81static int part_read_oob (struct mtd_info *mtd, loff_t from, size_t len,
100 size_t *retlen, u_char *buf) 82 size_t *retlen, u_char *buf)
101{ 83{
@@ -148,30 +130,8 @@ static int part_write (struct mtd_info *mtd, loff_t to, size_t len,
148 len = 0; 130 len = 0;
149 else if (to + len > mtd->size) 131 else if (to + len > mtd->size)
150 len = mtd->size - to; 132 len = mtd->size - to;
151 if (part->master->write_ecc == NULL) 133 return part->master->write (part->master, to + part->offset,
152 return part->master->write (part->master, to + part->offset, 134 len, retlen, buf);
153 len, retlen, buf);
154 else
155 return part->master->write_ecc (part->master, to + part->offset,
156 len, retlen, buf, NULL, &mtd->oobinfo);
157
158}
159
160static int part_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
161 size_t *retlen, const u_char *buf,
162 u_char *eccbuf, struct nand_oobinfo *oobsel)
163{
164 struct mtd_part *part = PART(mtd);
165 if (!(mtd->flags & MTD_WRITEABLE))
166 return -EROFS;
167 if (oobsel == NULL)
168 oobsel = &mtd->oobinfo;
169 if (to >= mtd->size)
170 len = 0;
171 else if (to + len > mtd->size)
172 len = mtd->size - to;
173 return part->master->write_ecc (part->master, to + part->offset,
174 len, retlen, buf, eccbuf, oobsel);
175} 135}
176 136
177static int part_write_oob (struct mtd_info *mtd, loff_t to, size_t len, 137static int part_write_oob (struct mtd_info *mtd, loff_t to, size_t len,
@@ -372,10 +332,6 @@ int add_mtd_partitions(struct mtd_info *master,
372 slave->mtd.unpoint = part_unpoint; 332 slave->mtd.unpoint = part_unpoint;
373 } 333 }
374 334
375 if (master->read_ecc)
376 slave->mtd.read_ecc = part_read_ecc;
377 if (master->write_ecc)
378 slave->mtd.write_ecc = part_write_ecc;
379 if (master->read_oob) 335 if (master->read_oob)
380 slave->mtd.read_oob = part_read_oob; 336 slave->mtd.read_oob = part_read_oob;
381 if (master->write_oob) 337 if (master->write_oob)