diff options
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r-- | drivers/mtd/mtdcore.c | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 9905870f56e..16a952dd486 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -47,6 +47,7 @@ int add_mtd_device(struct mtd_info *mtd) | |||
47 | { | 47 | { |
48 | int i; | 48 | int i; |
49 | 49 | ||
50 | BUG_ON(mtd->writesize == 0); | ||
50 | mutex_lock(&mtd_table_mutex); | 51 | mutex_lock(&mtd_table_mutex); |
51 | 52 | ||
52 | for (i=0; i < MAX_MTD_DEVICES; i++) | 53 | for (i=0; i < MAX_MTD_DEVICES; i++) |
@@ -254,37 +255,6 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
254 | return ret; | 255 | return ret; |
255 | } | 256 | } |
256 | 257 | ||
257 | |||
258 | /* default_mtd_readv - default mtd readv method for MTD devices that dont | ||
259 | * implement their own | ||
260 | */ | ||
261 | |||
262 | int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, | ||
263 | unsigned long count, loff_t from, size_t *retlen) | ||
264 | { | ||
265 | unsigned long i; | ||
266 | size_t totlen = 0, thislen; | ||
267 | int ret = 0; | ||
268 | |||
269 | if(!mtd->read) { | ||
270 | ret = -EIO; | ||
271 | } else { | ||
272 | for (i=0; i<count; i++) { | ||
273 | if (!vecs[i].iov_len) | ||
274 | continue; | ||
275 | ret = mtd->read(mtd, from, vecs[i].iov_len, &thislen, vecs[i].iov_base); | ||
276 | totlen += thislen; | ||
277 | if (ret || thislen != vecs[i].iov_len) | ||
278 | break; | ||
279 | from += vecs[i].iov_len; | ||
280 | } | ||
281 | } | ||
282 | if (retlen) | ||
283 | *retlen = totlen; | ||
284 | return ret; | ||
285 | } | ||
286 | |||
287 | |||
288 | EXPORT_SYMBOL(add_mtd_device); | 258 | EXPORT_SYMBOL(add_mtd_device); |
289 | EXPORT_SYMBOL(del_mtd_device); | 259 | EXPORT_SYMBOL(del_mtd_device); |
290 | EXPORT_SYMBOL(get_mtd_device); | 260 | EXPORT_SYMBOL(get_mtd_device); |
@@ -292,7 +262,6 @@ EXPORT_SYMBOL(put_mtd_device); | |||
292 | EXPORT_SYMBOL(register_mtd_user); | 262 | EXPORT_SYMBOL(register_mtd_user); |
293 | EXPORT_SYMBOL(unregister_mtd_user); | 263 | EXPORT_SYMBOL(unregister_mtd_user); |
294 | EXPORT_SYMBOL(default_mtd_writev); | 264 | EXPORT_SYMBOL(default_mtd_writev); |
295 | EXPORT_SYMBOL(default_mtd_readv); | ||
296 | 265 | ||
297 | #ifdef CONFIG_PROC_FS | 266 | #ifdef CONFIG_PROC_FS |
298 | 267 | ||