diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-18 15:07:42 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-22 16:14:16 +0200 |
commit | 69f3d6c93b814c3464dea57538b90552de14caf4 (patch) | |
tree | bc31e20986dd63a7e7fc9c29ee89fa07e16e2624 /include/linux | |
parent | d15561082121015724734c9eecf7f7f25d7c95b1 (diff) | |
download | barebox-69f3d6c93b814c3464dea57538b90552de14caf4.tar.gz barebox-69f3d6c93b814c3464dea57538b90552de14caf4.tar.xz |
mtd: introduce mtd_read_oob and mtd_write_oob
Directly copied from the Kernel as of 3.11-rc1
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mtd/mtd.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index da96483cf0..040e50d824 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -213,6 +213,19 @@ int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); +int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops); + +static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, + struct mtd_oob_ops *ops) +{ + ops->retlen = ops->oobretlen = 0; + if (!mtd->write_oob) + return -EOPNOTSUPP; + if (!(mtd->flags & MTD_WRITEABLE)) + return -EROFS; + return mtd->write_oob(mtd, to, ops); +} + static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) { do_div(sz, mtd->erasesize); |