diff options
Diffstat (limited to 'drivers/mtd/mtdconcat.c')
-rw-r--r-- | drivers/mtd/mtdconcat.c | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index a6fcee2713b..6d52137988f 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -143,116 +143,6 @@ concat_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
143 | } | 143 | } |
144 | 144 | ||
145 | static int | 145 | static int |
146 | concat_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, | ||
147 | size_t * retlen, u_char * buf, u_char * eccbuf, | ||
148 | struct nand_oobinfo *oobsel) | ||
149 | { | ||
150 | struct mtd_concat *concat = CONCAT(mtd); | ||
151 | int err = -EINVAL; | ||
152 | int i; | ||
153 | |||
154 | *retlen = 0; | ||
155 | |||
156 | for (i = 0; i < concat->num_subdev; i++) { | ||
157 | struct mtd_info *subdev = concat->subdev[i]; | ||
158 | size_t size, retsize; | ||
159 | |||
160 | if (from >= subdev->size) { | ||
161 | /* Not destined for this subdev */ | ||
162 | size = 0; | ||
163 | from -= subdev->size; | ||
164 | continue; | ||
165 | } | ||
166 | |||
167 | if (from + len > subdev->size) | ||
168 | /* First part goes into this subdev */ | ||
169 | size = subdev->size - from; | ||
170 | else | ||
171 | /* Entire transaction goes into this subdev */ | ||
172 | size = len; | ||
173 | |||
174 | if (subdev->read_ecc) | ||
175 | err = subdev->read_ecc(subdev, from, size, | ||
176 | &retsize, buf, eccbuf, oobsel); | ||
177 | else | ||
178 | err = -EINVAL; | ||
179 | |||
180 | if (err) | ||
181 | break; | ||
182 | |||
183 | *retlen += retsize; | ||
184 | len -= size; | ||
185 | if (len == 0) | ||
186 | break; | ||
187 | |||
188 | err = -EINVAL; | ||
189 | buf += size; | ||
190 | if (eccbuf) { | ||
191 | eccbuf += subdev->oobsize; | ||
192 | /* in nand.c at least, eccbufs are | ||
193 | tagged with 2 (int)eccstatus'; we | ||
194 | must account for these */ | ||
195 | eccbuf += 2 * (sizeof (int)); | ||
196 | } | ||
197 | from = 0; | ||
198 | } | ||
199 | return err; | ||
200 | } | ||
201 | |||
202 | static int | ||
203 | concat_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, | ||
204 | size_t * retlen, const u_char * buf, u_char * eccbuf, | ||
205 | struct nand_oobinfo *oobsel) | ||
206 | { | ||
207 | struct mtd_concat *concat = CONCAT(mtd); | ||
208 | int err = -EINVAL; | ||
209 | int i; | ||
210 | |||
211 | if (!(mtd->flags & MTD_WRITEABLE)) | ||
212 | return -EROFS; | ||
213 | |||
214 | *retlen = 0; | ||
215 | |||
216 | for (i = 0; i < concat->num_subdev; i++) { | ||
217 | struct mtd_info *subdev = concat->subdev[i]; | ||
218 | size_t size, retsize; | ||
219 | |||
220 | if (to >= subdev->size) { | ||
221 | size = 0; | ||
222 | to -= subdev->size; | ||
223 | continue; | ||
224 | } | ||
225 | if (to + len > subdev->size) | ||
226 | size = subdev->size - to; | ||
227 | else | ||
228 | size = len; | ||
229 | |||
230 | if (!(subdev->flags & MTD_WRITEABLE)) | ||
231 | err = -EROFS; | ||
232 | else if (subdev->write_ecc) | ||
233 | err = subdev->write_ecc(subdev, to, size, | ||
234 | &retsize, buf, eccbuf, oobsel); | ||
235 | else | ||
236 | err = -EINVAL; | ||
237 | |||
238 | if (err) | ||
239 | break; | ||
240 | |||
241 | *retlen += retsize; | ||
242 | len -= size; | ||
243 | if (len == 0) | ||
244 | break; | ||
245 | |||
246 | err = -EINVAL; | ||
247 | buf += size; | ||
248 | if (eccbuf) | ||
249 | eccbuf += subdev->oobsize; | ||
250 | to = 0; | ||
251 | } | ||
252 | return err; | ||
253 | } | ||
254 | |||
255 | static int | ||
256 | concat_writev(struct mtd_info *mtd, const struct kvec *vecs, | 146 | concat_writev(struct mtd_info *mtd, const struct kvec *vecs, |
257 | unsigned long count, loff_t to, size_t * retlen) | 147 | unsigned long count, loff_t to, size_t * retlen) |
258 | { | 148 | { |
@@ -823,10 +713,6 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
823 | concat->mtd.oobsize = subdev[0]->oobsize; | 713 | concat->mtd.oobsize = subdev[0]->oobsize; |
824 | concat->mtd.ecctype = subdev[0]->ecctype; | 714 | concat->mtd.ecctype = subdev[0]->ecctype; |
825 | concat->mtd.eccsize = subdev[0]->eccsize; | 715 | concat->mtd.eccsize = subdev[0]->eccsize; |
826 | if (subdev[0]->read_ecc) | ||
827 | concat->mtd.read_ecc = concat_read_ecc; | ||
828 | if (subdev[0]->write_ecc) | ||
829 | concat->mtd.write_ecc = concat_write_ecc; | ||
830 | if (subdev[0]->writev) | 716 | if (subdev[0]->writev) |
831 | concat->mtd.writev = concat_writev; | 717 | concat->mtd.writev = concat_writev; |
832 | if (subdev[0]->read_oob) | 718 | if (subdev[0]->read_oob) |
@@ -869,8 +755,6 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
869 | concat->mtd.oobsize != subdev[i]->oobsize || | 755 | concat->mtd.oobsize != subdev[i]->oobsize || |
870 | concat->mtd.ecctype != subdev[i]->ecctype || | 756 | concat->mtd.ecctype != subdev[i]->ecctype || |
871 | concat->mtd.eccsize != subdev[i]->eccsize || | 757 | concat->mtd.eccsize != subdev[i]->eccsize || |
872 | !concat->mtd.read_ecc != !subdev[i]->read_ecc || | ||
873 | !concat->mtd.write_ecc != !subdev[i]->write_ecc || | ||
874 | !concat->mtd.read_oob != !subdev[i]->read_oob || | 758 | !concat->mtd.read_oob != !subdev[i]->read_oob || |
875 | !concat->mtd.write_oob != !subdev[i]->write_oob) { | 759 | !concat->mtd.write_oob != !subdev[i]->write_oob) { |
876 | kfree(concat); | 760 | kfree(concat); |