diff options
author | Boris BREZILLON <boris.brezillon@free-electrons.com> | 2016-03-07 10:46:52 +0100 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2016-03-07 16:23:09 -0800 |
commit | 29f1058a90b319b01c4cf469720e0350212d5c9c (patch) | |
tree | 6094d39b99c1cae2d98d0459778852d7043690e1 /drivers/mtd/mtdpart.c | |
parent | f5b8aa78ef086248145363bf1ffe5ca4348b6a98 (diff) | |
download | linux-29f1058a90b319b01c4cf469720e0350212d5c9c.tar.bz2 |
mtd: create an mtd_oobavail() helper and make use of it
Currently, all MTD drivers/sublayers exposing an OOB area are
doing the same kind of test to extract the available OOB size
based on the mtd_info and mtd_oob_ops structures.
Move this common logic into an inline function and make use of it.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Suggested-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 10bf304027dd..08de4b2cf0f5 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -126,10 +126,7 @@ static int part_read_oob(struct mtd_info *mtd, loff_t from, if (ops->oobbuf) { size_t len, pages; - if (ops->mode == MTD_OPS_AUTO_OOB) - len = mtd->oobavail; - else - len = mtd->oobsize; + len = mtd_oobavail(mtd, ops); pages = mtd_div_by_ws(mtd->size, mtd); pages -= mtd_div_by_ws(from, mtd); if (ops->ooboffs + ops->ooblen > pages * len) |