From 8c1e760ab60994de26d2a2c85f91e86192999dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 23 Jun 2017 10:27:20 +0200 Subject: kernel: backport upstream mtdpart.c cleanups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Except for renames and line changes the only conflict was in allocate_partition in handling MTD_WRITEABLE. Hopefully it was handled correctly. Signed-off-by: Rafał Miłecki --- .../patches-4.9/412-mtd-partial_eraseblock_unlock.patch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'target/linux/generic/patches-4.9/412-mtd-partial_eraseblock_unlock.patch') diff --git a/target/linux/generic/patches-4.9/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/patches-4.9/412-mtd-partial_eraseblock_unlock.patch index e7c91c6..da4a902 100644 --- a/target/linux/generic/patches-4.9/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/patches-4.9/412-mtd-partial_eraseblock_unlock.patch @@ -1,20 +1,20 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -337,7 +337,16 @@ static int part_lock(struct mtd_info *mt +@@ -343,7 +343,16 @@ static int part_lock(struct mtd_info *mt static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { struct mtd_part *part = mtd_to_part(mtd); -- return part->master->_unlock(part->master, ofs + part->offset, len); +- return part->parent->_unlock(part->parent, ofs + part->offset, len); + + ofs += part->offset; + + if (mtd->flags & MTD_ERASE_PARTIAL) { + /* round up len to next erasesize and round down offset to prev block */ -+ len = (mtd_div_by_eb(len, part->master) + 1) * part->master->erasesize; -+ ofs &= ~(part->master->erasesize - 1); ++ len = (mtd_div_by_eb(len, part->parent) + 1) * part->parent->erasesize; ++ ofs &= ~(part->parent->erasesize - 1); + } + -+ return part->master->_unlock(part->master, ofs, len); ++ return part->parent->_unlock(part->parent, ofs, len); } static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) -- cgit v1.1