From: Rafał Miłecki Date: Fri, 4 Dec 2015 09:33:08 +0000 (+0000) Subject: kernel: drop unneeded modification of mtd_add_partition function X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=304c3411baac0f77b38f97360072c36a5ac8479b;p=openwrt%2Fstaging%2Fkaloz.git kernel: drop unneeded modification of mtd_add_partition function In old days mtd_add_partition was checking for partitions overlapping which was breaking our splitting feature. We had to modify this function by adding an extra bool dup_check parameter. Upstream commit: 3a434f66e6da ("mtd: part: Remove partition overlap checks") removed that check so we don't need our modification anymore. Signed-off-by: Rafał Miłecki SVN-Revision: 47748 --- diff --git a/target/linux/generic/patches-4.4/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/patches-4.4/400-mtd-add-rootfs-split-support.patch index 74a0ecdcef..7925caf97c 100644 --- a/target/linux/generic/patches-4.4/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/patches-4.4/400-mtd-add-rootfs-split-support.patch @@ -40,7 +40,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -47,13 +49,14 @@ struct mtd_part { +@@ -47,6 +49,8 @@ struct mtd_part { struct list_head list; }; @@ -49,27 +49,7 @@ /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve * the pointer to that structure with this macro. - */ - #define PART(x) ((struct mtd_part *)(x)) - -- - /* - * MTD methods which simply translate the effective address and pass through - * to the _real_ device. -@@ -579,8 +582,10 @@ static int mtd_add_partition_attrs(struc - return ret; - } - --int mtd_add_partition(struct mtd_info *master, const char *name, -- long long offset, long long length) -+ -+static int -+__mtd_add_partition(struct mtd_info *master, const char *name, -+ long long offset, long long length, bool dup_check) - { - struct mtd_partition part; - struct mtd_part *new; -@@ -612,6 +617,7 @@ int mtd_add_partition(struct mtd_info *m +@@ -612,6 +616,7 @@ int mtd_add_partition(struct mtd_info *m mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); @@ -77,20 +57,7 @@ mtd_add_partition_attrs(new); -@@ -619,6 +625,12 @@ int mtd_add_partition(struct mtd_info *m - } - EXPORT_SYMBOL_GPL(mtd_add_partition); - -+int mtd_add_partition(struct mtd_info *master, const char *name, -+ long long offset, long long length) -+{ -+ return __mtd_add_partition(master, name, offset, length, true); -+} -+ - int mtd_del_partition(struct mtd_info *master, int partno) - { - struct mtd_part *slave, *next; -@@ -644,6 +656,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -644,6 +649,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -126,7 +93,7 @@ /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to -@@ -675,6 +716,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -675,6 +709,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); diff --git a/target/linux/generic/patches-4.4/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/patches-4.4/401-mtd-add-support-for-different-partition-parser-types.patch index 95f20f7d2b..7695d56de9 100644 --- a/target/linux/generic/patches-4.4/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/patches-4.4/401-mtd-add-support-for-different-partition-parser-types.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -747,6 +747,30 @@ static struct mtd_part_parser *get_parti +@@ -740,6 +740,30 @@ static struct mtd_part_parser *get_parti #define put_partition_parser(p) do { module_put((p)->owner); } while (0) @@ -42,7 +42,7 @@ Signed-off-by: Gabor Juhos void register_mtd_parser(struct mtd_part_parser *p) { spin_lock(&part_parser_lock); -@@ -875,6 +899,38 @@ int parse_mtd_partitions(struct mtd_info +@@ -868,6 +892,38 @@ int parse_mtd_partitions(struct mtd_info return err; } diff --git a/target/linux/generic/patches-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/patches-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 725dbe8b4d..2ea2056ba2 100644 --- a/target/linux/generic/patches-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/patches-4.4/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -656,6 +656,37 @@ int mtd_del_partition(struct mtd_info *m +@@ -649,6 +649,36 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -23,11 +23,10 @@ + /* adjust partition offsets */ + parts[i].offset += slave->offset; + -+ __mtd_add_partition(slave->master, -+ parts[i].name, -+ parts[i].offset, -+ parts[i].size, -+ false); ++ mtd_add_partition(slave->master, ++ parts[i].name, ++ parts[i].offset, ++ parts[i].size); + } + + kfree(parts); @@ -38,7 +37,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -664,6 +695,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -657,6 +687,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -46,7 +45,7 @@ } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -678,6 +710,12 @@ static void mtd_partition_split(struct m +@@ -671,6 +702,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/patches-4.4/404-mtd-add-more-helper-functions.patch b/target/linux/generic/patches-4.4/404-mtd-add-more-helper-functions.patch index be7ba7754d..3773e1f195 100644 --- a/target/linux/generic/patches-4.4/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/patches-4.4/404-mtd-add-more-helper-functions.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -453,14 +453,12 @@ static struct mtd_part *allocate_partiti +@@ -454,14 +454,12 @@ static struct mtd_part *allocate_partiti if (slave->offset == MTDPART_OFS_APPEND) slave->offset = cur_offset; if (slave->offset == MTDPART_OFS_NXTBLK) { @@ -18,7 +18,7 @@ } if (slave->offset == MTDPART_OFS_RETAIN) { slave->offset = cur_offset; -@@ -687,6 +685,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -679,6 +677,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -36,7 +36,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -986,6 +995,24 @@ int mtd_is_partition(const struct mtd_in +@@ -978,6 +987,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/patches-4.4/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-4.4/411-mtd-partial_eraseblock_write.patch index e6e809cf3c..7ab8eb3442 100644 --- a/target/linux/generic/patches-4.4/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/patches-4.4/411-mtd-partial_eraseblock_write.patch @@ -9,7 +9,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -235,13 +237,61 @@ static int part_erase(struct mtd_info *m +@@ -236,13 +238,61 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = PART(mtd); int ret; @@ -71,7 +71,7 @@ return ret; } -@@ -249,7 +299,25 @@ void mtd_erase_callback(struct erase_inf +@@ -250,7 +300,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = PART(instr->mtd); @@ -97,7 +97,7 @@ if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; instr->addr -= part->offset; -@@ -522,17 +590,20 @@ static struct mtd_part *allocate_partiti +@@ -523,17 +591,20 @@ static struct mtd_part *allocate_partiti if ((slave->mtd.flags & MTD_WRITEABLE) && mtd_mod_by_eb(slave->offset, &slave->mtd)) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/patches-4.4/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/patches-4.4/412-mtd-partial_eraseblock_unlock.patch index b7964e25b8..990c2aba6e 100644 --- a/target/linux/generic/patches-4.4/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/patches-4.4/412-mtd-partial_eraseblock_unlock.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -336,7 +336,14 @@ static int part_lock(struct mtd_info *mt +@@ -337,7 +337,14 @@ 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 = PART(mtd);