diff options
-rw-r--r-- | drivers/mtd/mtdconcat.c | 5 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 4 | ||||
-rw-r--r-- | fs/jffs2/writev.c | 2 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 18 |
4 files changed, 18 insertions, 11 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 3d9c1ffdbbbf..6fdae191e1ba 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -227,8 +227,9 @@ concat_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
227 | if (!(subdev->flags & MTD_WRITEABLE)) | 227 | if (!(subdev->flags & MTD_WRITEABLE)) |
228 | err = -EROFS; | 228 | err = -EROFS; |
229 | else | 229 | else |
230 | err = subdev->writev(subdev, &vecs_copy[entry_low], | 230 | err = mtd_writev(subdev, &vecs_copy[entry_low], |
231 | entry_high - entry_low + 1, to, &retsize); | 231 | entry_high - entry_low + 1, to, |
232 | &retsize); | ||
232 | 233 | ||
233 | vecs_copy[entry_high].iov_len = old_iov_len - size; | 234 | vecs_copy[entry_high].iov_len = old_iov_len - size; |
234 | vecs_copy[entry_high].iov_base += size; | 235 | vecs_copy[entry_high].iov_base += size; |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 0bb16d6ed08a..c0bfa88c82f3 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -238,8 +238,8 @@ static int part_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
238 | struct mtd_part *part = PART(mtd); | 238 | struct mtd_part *part = PART(mtd); |
239 | if (!(mtd->flags & MTD_WRITEABLE)) | 239 | if (!(mtd->flags & MTD_WRITEABLE)) |
240 | return -EROFS; | 240 | return -EROFS; |
241 | return part->master->writev(part->master, vecs, count, | 241 | return mtd_writev(part->master, vecs, count, to + part->offset, |
242 | to + part->offset, retlen); | 242 | retlen); |
243 | } | 243 | } |
244 | 244 | ||
245 | static int part_erase(struct mtd_info *mtd, struct erase_info *instr) | 245 | static int part_erase(struct mtd_info *mtd, struct erase_info *instr) |
diff --git a/fs/jffs2/writev.c b/fs/jffs2/writev.c index b05710fd552a..d0ef068709ad 100644 --- a/fs/jffs2/writev.c +++ b/fs/jffs2/writev.c | |||
@@ -52,7 +52,7 @@ int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct kvec *vecs, | |||
52 | } | 52 | } |
53 | 53 | ||
54 | if (c->mtd->writev) | 54 | if (c->mtd->writev) |
55 | return c->mtd->writev(c->mtd, vecs, count, to, retlen); | 55 | return mtd_writev(c->mtd, vecs, count, to, retlen); |
56 | else { | 56 | else { |
57 | return mtd_fake_writev(c->mtd, vecs, count, to, retlen); | 57 | return mtd_fake_writev(c->mtd, vecs, count, to, retlen); |
58 | } | 58 | } |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index b58e5e8746ec..4129cb5c3de4 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -204,18 +204,14 @@ struct mtd_info { | |||
204 | size_t *retlen, u_char *buf); | 204 | size_t *retlen, u_char *buf); |
205 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, | 205 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
206 | size_t len); | 206 | size_t len); |
207 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, | ||
208 | unsigned long count, loff_t to, size_t *retlen); | ||
207 | 209 | ||
208 | /* Backing device capabilities for this device | 210 | /* Backing device capabilities for this device |
209 | * - provides mmap capabilities | 211 | * - provides mmap capabilities |
210 | */ | 212 | */ |
211 | struct backing_dev_info *backing_dev_info; | 213 | struct backing_dev_info *backing_dev_info; |
212 | 214 | ||
213 | /* kvec-based read/write methods. | ||
214 | NB: The 'count' parameter is the number of _vectors_, each of | ||
215 | which contains an (ofs, len) tuple. | ||
216 | */ | ||
217 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); | ||
218 | |||
219 | /* Sync */ | 215 | /* Sync */ |
220 | void (*sync) (struct mtd_info *mtd); | 216 | void (*sync) (struct mtd_info *mtd); |
221 | 217 | ||
@@ -375,6 +371,16 @@ static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, | |||
375 | return mtd->lock_user_prot_reg(mtd, from, len); | 371 | return mtd->lock_user_prot_reg(mtd, from, len); |
376 | } | 372 | } |
377 | 373 | ||
374 | /* | ||
375 | * kvec-based read/write method. NB: The 'count' parameter is the number of | ||
376 | * _vectors_, each of which contains an (ofs, len) tuple. | ||
377 | */ | ||
378 | static inline int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | ||
379 | unsigned long count, loff_t to, size_t *retlen) | ||
380 | { | ||
381 | return mtd->writev(mtd, vecs, count, to, retlen); | ||
382 | } | ||
383 | |||
378 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | 384 | static inline struct mtd_info *dev_to_mtd(struct device *dev) |
379 | { | 385 | { |
380 | return dev ? dev_get_drvdata(dev) : NULL; | 386 | return dev ? dev_get_drvdata(dev) : NULL; |