9
0
Fork 0

mtd: partition: implement write_oob

To enable mtd_write_oob for partitions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2015-06-11 15:45:56 +02:00
parent fd0007a9ef
commit ff40732d0a
1 changed files with 13 additions and 0 deletions

View File

@ -31,6 +31,16 @@ static int mtd_part_write(struct mtd_info *mtd, loff_t to, size_t len,
len, retlen, buf);
}
static int mtd_part_write_oob(struct mtd_info *mtd, loff_t to,
struct mtd_oob_ops *ops)
{
if (to >= mtd->size)
return -EINVAL;
if (ops->datbuf && to + ops->len > mtd->size)
return -EINVAL;
return mtd->master->write_oob(mtd->master, to + mtd->master_offset, ops);
}
static int mtd_part_erase(struct mtd_info *mtd, struct erase_info *instr)
{
int ret;
@ -160,6 +170,9 @@ struct mtd_info *mtd_add_partition(struct mtd_info *mtd, off_t offset,
part->block_markbad = mtd->block_markbad ? mtd_part_block_markbad : NULL;
}
if (mtd->write_oob)
part->write_oob = mtd_part_write_oob;
part->block_isbad = mtd->block_isbad ? mtd_part_block_isbad : NULL;
part->size = size;
part->name = xstrdup(name);