aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/devices/block2mtd.c2
-rw-r--r--drivers/mtd/mtdcore.c26
2 files changed, 24 insertions, 4 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index b78f23169d4e..c16f6b4e8938 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -288,7 +288,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
288 dev->mtd.flags = MTD_CAP_RAM; 288 dev->mtd.flags = MTD_CAP_RAM;
289 dev->mtd.erase = block2mtd_erase; 289 dev->mtd.erase = block2mtd_erase;
290 dev->mtd.write = block2mtd_write; 290 dev->mtd.write = block2mtd_write;
291 dev->mtd.writev = default_mtd_writev; 291 dev->mtd.writev = mtd_writev;
292 dev->mtd.sync = block2mtd_sync; 292 dev->mtd.sync = block2mtd_sync;
293 dev->mtd.read = block2mtd_read; 293 dev->mtd.read = block2mtd_read;
294 dev->mtd.priv = dev; 294 dev->mtd.priv = dev;
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 53a200f722b6..4d0f3e557bd1 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -696,8 +696,8 @@ EXPORT_SYMBOL_GPL(__put_mtd_device);
696 * This function returns zero in case of success and a negative error code in 696 * This function returns zero in case of success and a negative error code in
697 * case of failure. 697 * case of failure.
698 */ 698 */
699int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, 699static int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
700 unsigned long count, loff_t to, size_t *retlen) 700 unsigned long count, loff_t to, size_t *retlen)
701{ 701{
702 unsigned long i; 702 unsigned long i;
703 size_t totlen = 0, thislen; 703 size_t totlen = 0, thislen;
@@ -716,7 +716,27 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
716 *retlen = totlen; 716 *retlen = totlen;
717 return ret; 717 return ret;
718} 718}
719EXPORT_SYMBOL_GPL(default_mtd_writev); 719
720/*
721 * mtd_writev - the vector-based MTD write method
722 * @mtd: mtd device description object pointer
723 * @vecs: the vectors to write
724 * @count: count of vectors in @vecs
725 * @to: the MTD device offset to write to
726 * @retlen: on exit contains the count of bytes written to the MTD device.
727 *
728 * This function returns zero in case of success and a negative error code in
729 * case of failure.
730 */
731int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
732 unsigned long count, loff_t to, size_t *retlen)
733{
734 *retlen = 0;
735 if (!mtd->writev)
736 return default_mtd_writev(mtd, vecs, count, to, retlen);
737 return mtd->writev(mtd, vecs, count, to, retlen);
738}
739EXPORT_SYMBOL_GPL(mtd_writev);
720 740
721/** 741/**
722 * mtd_kmalloc_up_to - allocate a contiguous buffer up to the specified size 742 * mtd_kmalloc_up_to - allocate a contiguous buffer up to the specified size