From ea608797aa06b5832fbda13afa8fb9cae18fd764 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Sat, 24 Nov 2018 14:38:40 +0800 Subject: [PATCH] kernel: drop mtd_pad_erasesize() helper --- ...for-different-partition-parser-types.patch | 78 +++++++++++++------ ...arsers-for-rootfs-and-firmware-split.patch | 43 +--------- .../404-mtd-add-more-helper-functions.patch | 22 +----- .../411-mtd-partial_eraseblock_write.patch | 6 +- .../412-mtd-partial_eraseblock_unlock.patch | 2 +- ...for-different-partition-parser-types.patch | 78 +++++++++++++------ ...arsers-for-rootfs-and-firmware-split.patch | 43 +--------- .../404-mtd-add-more-helper-functions.patch | 22 +----- .../411-mtd-partial_eraseblock_write.patch | 6 +- .../412-mtd-partial_eraseblock_unlock.patch | 2 +- 10 files changed, 128 insertions(+), 174 deletions(-) diff --git a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch index a683db359..a48ae87ea 100644 --- a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch @@ -9,7 +9,55 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1118,6 +1118,62 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -56,6 +56,10 @@ struct mtd_part { + }; + + static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); ++static int parse_mtd_partitions_by_type(struct mtd_info *master, ++ enum mtd_parser_type type, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data); + + /* + * Given a pointer to the MTD object in the mtd_part structure, we can retrieve +@@ -741,6 +745,36 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + ++static int ++run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) ++{ ++ struct mtd_partition *parts; ++ int nr_parts; ++ int i; ++ ++ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, ++ NULL); ++ if (nr_parts <= 0) ++ return nr_parts; ++ ++ if (WARN_ON(!parts)) ++ return 0; ++ ++ for (i = 0; i < nr_parts; i++) { ++ /* adjust partition offsets */ ++ parts[i].offset += slave->offset; ++ ++ mtd_add_partition(slave->parent, ++ parts[i].name, ++ parts[i].offset, ++ parts[i].size); ++ } ++ ++ kfree(parts); ++ ++ return nr_parts; ++} ++ + #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME + #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME + #else +@@ -1118,6 +1152,61 @@ void mtd_part_parser_cleanup(struct mtd_ } } @@ -37,10 +85,10 @@ Signed-off-by: Gabor Juhos + return ret; +} + -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) ++static int parse_mtd_partitions_by_type(struct mtd_info *master, ++ enum mtd_parser_type type, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) +{ + struct mtd_part_parser *prev = NULL; + int ret = 0; @@ -67,19 +115,13 @@ Signed-off-by: Gabor Juhos + + return ret; +} -+EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); + int mtd_is_partition(const struct mtd_info *mtd) { struct mtd_part *part; --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -68,11 +68,14 @@ struct mtd_part_parser_data { - unsigned long origin; - }; - -- - /* +@@ -73,6 +73,10 @@ struct mtd_part_parser_data { * Functions dealing with the various ways of partitioning the space */ @@ -90,7 +132,7 @@ Signed-off-by: Gabor Juhos struct mtd_part_parser { struct list_head list; struct module *owner; -@@ -81,6 +84,7 @@ struct mtd_part_parser { +@@ -81,6 +85,7 @@ struct mtd_part_parser { int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, struct mtd_part_parser_data *); void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); @@ -98,13 +140,3 @@ Signed-off-by: Gabor Juhos }; /* Container for passing around a set of parsed partitions */ -@@ -113,4 +117,9 @@ uint64_t mtd_get_device_size(const struc - extern void __weak arch_split_mtd_part(struct mtd_info *master, - const char *name, int offset, int size); - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); -+ - #endif diff --git a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index f93b816a3..3c105b2a4 100644 --- a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,44 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -741,6 +741,36 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+static int -+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) -+{ -+ struct mtd_partition *parts; -+ int nr_parts; -+ int i; -+ -+ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, -+ NULL); -+ if (nr_parts <= 0) -+ return nr_parts; -+ -+ if (WARN_ON(!parts)) -+ return 0; -+ -+ for (i = 0; i < nr_parts; i++) { -+ /* adjust partition offsets */ -+ parts[i].offset += slave->offset; -+ -+ mtd_add_partition(slave->parent, -+ parts[i].name, -+ parts[i].offset, -+ parts[i].size); -+ } -+ -+ kfree(parts); -+ -+ return nr_parts; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -749,6 +779,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -783,6 +783,7 @@ run_parsers_by_type(struct mtd_part *sla static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +18,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -763,6 +794,12 @@ static void mtd_partition_split(struct m +@@ -797,6 +798,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; @@ -70,7 +33,7 @@ Signed-off-by: Gabor Juhos split_firmware(master, part); --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -74,6 +74,8 @@ struct mtd_part_parser_data { +@@ -75,6 +75,8 @@ struct mtd_part_parser_data { enum mtd_parser_type { MTD_PARSER_TYPE_DEVICE = 0, diff --git a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch index 523ff531a..b37563c90 100644 --- a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch @@ -11,25 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -771,6 +771,17 @@ run_parsers_by_type(struct mtd_part *sla - return nr_parts; - } - -+static inline unsigned long -+mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) -+{ -+ unsigned long mask = mtd->erasesize - 1; -+ -+ len += offset & mask; -+ len = (len + mask) & ~mask; -+ len -= offset & mask; -+ return len; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -1228,6 +1239,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1231,6 +1231,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); @@ -83,7 +65,7 @@ Signed-off-by: Gabor Juhos if (mtd->writesize_shift) --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -115,6 +115,8 @@ int mtd_is_partition(const struct mtd_in +@@ -116,6 +116,8 @@ int mtd_is_partition(const struct mtd_in int mtd_add_partition(struct mtd_info *master, const char *name, long long offset, long long length); int mtd_del_partition(struct mtd_info *master, int partno); diff --git a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch index 8497bfb76..a99508310 100644 --- a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -242,13 +244,61 @@ static int part_erase(struct mtd_info *m +@@ -246,13 +248,61 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = mtd_to_part(mtd); int ret; @@ -81,7 +81,7 @@ Signed-off-by: Felix Fietkau return ret; } -@@ -256,6 +306,25 @@ void mtd_erase_callback(struct erase_inf +@@ -260,6 +310,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = mtd_to_part(instr->mtd); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; -@@ -570,19 +639,22 @@ static struct mtd_part *allocate_partiti +@@ -574,19 +643,22 @@ static struct mtd_part *allocate_partiti remainder = do_div(tmp, wr_alignment); if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/pending-4.14/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-4.14/412-mtd-partial_eraseblock_unlock.patch index 2ffff4ecf..1e8c90931 100644 --- a/target/linux/generic/pending-4.14/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/pending-4.14/412-mtd-partial_eraseblock_unlock.patch @@ -20,7 +20,7 @@ Signed-off-by: Tim Harvey --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -344,7 +344,16 @@ static int part_lock(struct mtd_info *mt +@@ -348,7 +348,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); diff --git a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch index 1188cc656..0eb6d7422 100644 --- a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch @@ -9,7 +9,55 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1115,6 +1115,62 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -56,6 +56,10 @@ struct mtd_part { + }; + + static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); ++static int parse_mtd_partitions_by_type(struct mtd_info *master, ++ enum mtd_parser_type type, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data); + + /* + * Given a pointer to the MTD object in the mtd_part structure, we can retrieve +@@ -733,6 +737,36 @@ int mtd_del_partition(struct mtd_info *m + } + EXPORT_SYMBOL_GPL(mtd_del_partition); + ++static int ++run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) ++{ ++ struct mtd_partition *parts; ++ int nr_parts; ++ int i; ++ ++ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, ++ NULL); ++ if (nr_parts <= 0) ++ return nr_parts; ++ ++ if (WARN_ON(!parts)) ++ return 0; ++ ++ for (i = 0; i < nr_parts; i++) { ++ /* adjust partition offsets */ ++ parts[i].offset += slave->offset; ++ ++ mtd_add_partition(slave->parent, ++ parts[i].name, ++ parts[i].offset, ++ parts[i].size); ++ } ++ ++ kfree(parts); ++ ++ return nr_parts; ++} ++ + #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME + #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME + #else +@@ -1115,6 +1149,61 @@ void mtd_part_parser_cleanup(struct mtd_ } } @@ -37,10 +85,10 @@ Signed-off-by: Gabor Juhos + return ret; +} + -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data) ++static int parse_mtd_partitions_by_type(struct mtd_info *master, ++ enum mtd_parser_type type, ++ const struct mtd_partition **pparts, ++ struct mtd_part_parser_data *data) +{ + struct mtd_part_parser *prev = NULL; + int ret = 0; @@ -67,19 +115,13 @@ Signed-off-by: Gabor Juhos + + return ret; +} -+EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type); + int mtd_is_partition(const struct mtd_info *mtd) { struct mtd_part *part; --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -68,11 +68,14 @@ struct mtd_part_parser_data { - unsigned long origin; - }; - -- - /* +@@ -73,6 +73,10 @@ struct mtd_part_parser_data { * Functions dealing with the various ways of partitioning the space */ @@ -90,7 +132,7 @@ Signed-off-by: Gabor Juhos struct mtd_part_parser { struct list_head list; struct module *owner; -@@ -81,6 +84,7 @@ struct mtd_part_parser { +@@ -81,6 +85,7 @@ struct mtd_part_parser { int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, struct mtd_part_parser_data *); void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); @@ -98,13 +140,3 @@ Signed-off-by: Gabor Juhos }; /* Container for passing around a set of parsed partitions */ -@@ -113,4 +117,9 @@ uint64_t mtd_get_device_size(const struc - extern void __weak arch_split_mtd_part(struct mtd_info *master, - const char *name, int offset, int size); - -+int parse_mtd_partitions_by_type(struct mtd_info *master, -+ enum mtd_parser_type type, -+ const struct mtd_partition **pparts, -+ struct mtd_part_parser_data *data); -+ - #endif diff --git a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 9c2650b45..3cb27c760 100644 --- a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,44 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -733,6 +733,36 @@ int mtd_del_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_del_partition); - -+static int -+run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) -+{ -+ struct mtd_partition *parts; -+ int nr_parts; -+ int i; -+ -+ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, -+ NULL); -+ if (nr_parts <= 0) -+ return nr_parts; -+ -+ if (WARN_ON(!parts)) -+ return 0; -+ -+ for (i = 0; i < nr_parts; i++) { -+ /* adjust partition offsets */ -+ parts[i].offset += slave->offset; -+ -+ mtd_add_partition(slave->parent, -+ parts[i].name, -+ parts[i].offset, -+ parts[i].size); -+ } -+ -+ kfree(parts); -+ -+ return nr_parts; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -741,6 +771,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -775,6 +775,7 @@ run_parsers_by_type(struct mtd_part *sla static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +18,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -755,6 +786,12 @@ static void mtd_partition_split(struct m +@@ -789,6 +790,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; @@ -70,7 +33,7 @@ Signed-off-by: Gabor Juhos split_firmware(master, part); --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -74,6 +74,8 @@ struct mtd_part_parser_data { +@@ -75,6 +75,8 @@ struct mtd_part_parser_data { enum mtd_parser_type { MTD_PARSER_TYPE_DEVICE = 0, diff --git a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch index 886dece4f..300a0b026 100644 --- a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch @@ -11,25 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -763,6 +763,17 @@ run_parsers_by_type(struct mtd_part *sla - return nr_parts; - } - -+static inline unsigned long -+mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) -+{ -+ unsigned long mask = mtd->erasesize - 1; -+ -+ len += offset & mask; -+ len = (len + mask) & ~mask; -+ len -= offset & mask; -+ return len; -+} -+ - #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME - #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME - #else -@@ -1225,6 +1236,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1228,6 +1228,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); @@ -83,7 +65,7 @@ Signed-off-by: Gabor Juhos if (mtd->writesize_shift) --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -115,6 +115,8 @@ int mtd_is_partition(const struct mtd_in +@@ -116,6 +116,8 @@ int mtd_is_partition(const struct mtd_in int mtd_add_partition(struct mtd_info *master, const char *name, long long offset, long long length); int mtd_del_partition(struct mtd_info *master, int partno); diff --git a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch index 4e66272bb..5a59dfa0c 100644 --- a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -242,13 +244,61 @@ static int part_erase(struct mtd_info *m +@@ -246,13 +248,61 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = mtd_to_part(mtd); int ret; @@ -81,7 +81,7 @@ Signed-off-by: Felix Fietkau return ret; } -@@ -256,6 +306,25 @@ void mtd_erase_callback(struct erase_inf +@@ -260,6 +310,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = mtd_to_part(instr->mtd); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; -@@ -562,19 +631,22 @@ static struct mtd_part *allocate_partiti +@@ -566,19 +635,22 @@ static struct mtd_part *allocate_partiti remainder = do_div(tmp, wr_alignment); if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch index 2ffff4ecf..1e8c90931 100644 --- a/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch @@ -20,7 +20,7 @@ Signed-off-by: Tim Harvey --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -344,7 +344,16 @@ static int part_lock(struct mtd_info *mt +@@ -348,7 +348,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);