Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282912
b: refs/heads/master
c: 1dbebd3
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed Jan 9, 2012
1 parent 2820ab4 commit e82e2f3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e2936b2af5562c8c66060e2bc2ae2e209d0acd3d
refs/heads/master: 1dbebd32562b3c2caeca35960e5cb00bfcc12900
2 changes: 1 addition & 1 deletion trunk/drivers/mtd/devices/block2mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
dev->mtd.flags = MTD_CAP_RAM;
dev->mtd.erase = block2mtd_erase;
dev->mtd.write = block2mtd_write;
dev->mtd.writev = default_mtd_writev;
dev->mtd.writev = mtd_writev;
dev->mtd.sync = block2mtd_sync;
dev->mtd.read = block2mtd_read;
dev->mtd.priv = dev;
Expand Down
26 changes: 23 additions & 3 deletions trunk/drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,8 @@ EXPORT_SYMBOL_GPL(__put_mtd_device);
* This function returns zero in case of success and a negative error code in
* case of failure.
*/
int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen)
static int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen)
{
unsigned long i;
size_t totlen = 0, thislen;
Expand All @@ -716,7 +716,27 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
*retlen = totlen;
return ret;
}
EXPORT_SYMBOL_GPL(default_mtd_writev);

/*
* mtd_writev - the vector-based MTD write method
* @mtd: mtd device description object pointer
* @vecs: the vectors to write
* @count: count of vectors in @vecs
* @to: the MTD device offset to write to
* @retlen: on exit contains the count of bytes written to the MTD device.
*
* This function returns zero in case of success and a negative error code in
* case of failure.
*/
int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen)
{
*retlen = 0;
if (!mtd->writev)
return default_mtd_writev(mtd, vecs, count, to, retlen);
return mtd->writev(mtd, vecs, count, to, retlen);
}
EXPORT_SYMBOL_GPL(mtd_writev);

/**
* mtd_kmalloc_up_to - allocate a contiguous buffer up to the specified size
Expand Down
6 changes: 1 addition & 5 deletions trunk/fs/jffs2/writev.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct kvec *vecs,
}
}

if (c->mtd->writev)
return mtd_writev(c->mtd, vecs, count, to, retlen);
else {
return default_mtd_writev(c->mtd, vecs, count, to, retlen);
}
return mtd_writev(c->mtd, vecs, count, to, retlen);
}

int jffs2_flash_direct_write(struct jffs2_sb_info *c, loff_t ofs, size_t len,
Expand Down
16 changes: 2 additions & 14 deletions trunk/include/linux/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,8 @@ static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
return mtd->lock_user_prot_reg(mtd, from, len);
}

/*
* kvec-based read/write method. NB: The 'count' parameter is the number of
* _vectors_, each of which contains an (ofs, len) tuple.
*/
static inline int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen)
{
*retlen = 0;
return mtd->writev(mtd, vecs, count, to, retlen);
}
int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen);

static inline void mtd_sync(struct mtd_info *mtd)
{
Expand Down Expand Up @@ -510,10 +502,6 @@ struct mtd_notifier {

extern void register_mtd_user (struct mtd_notifier *new);
extern int unregister_mtd_user (struct mtd_notifier *old);

int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
unsigned long count, loff_t to, size_t *retlen);

void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);

void mtd_erase_callback(struct erase_info *instr);
Expand Down

0 comments on commit e82e2f3

Please sign in to comment.