OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 58... | Line 58... | |||
58 | +static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); |
58 | +static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part); |
|
59 | + |
59 | + |
|
60 | /* |
60 | /* |
|
61 | * Given a pointer to the MTD object in the mtd_part structure, we can retrieve |
61 | * Given a pointer to the MTD object in the mtd_part structure, we can retrieve |
|
62 | * the pointer to that structure. |
62 | * the pointer to that structure. |
|
63 | @@ -668,6 +672,7 @@ int mtd_add_partition(struct mtd_info *p |
63 | @@ -658,6 +662,7 @@ int mtd_add_partition(struct mtd_info *p |
|
64 | mutex_unlock(&mtd_partitions_mutex); |
64 | mutex_unlock(&mtd_partitions_mutex); |
|
Line 65... | Line 65... | |||
65 | |
65 | |
|
66 | add_mtd_device(&new->mtd); |
66 | add_mtd_device(&new->mtd); |
|
Line 67... | Line 67... | |||
67 | + mtd_partition_split(parent, new); |
67 | + mtd_partition_split(parent, new); |
|
Line 68... | Line 68... | |||
68 | |
68 | |
|
69 | mtd_add_partition_attrs(new); |
69 | mtd_add_partition_attrs(new); |
|
70 | |
70 | |
|
Line 71... | Line 71... | |||
71 | @@ -746,6 +751,29 @@ int mtd_del_partition(struct mtd_info *m |
71 | @@ -736,6 +741,35 @@ int mtd_del_partition(struct mtd_info *m |
|
72 | } |
72 | } |
|
Line 80... | Line 80... | |||
80 | + |
80 | + |
|
81 | +static void split_firmware(struct mtd_info *master, struct mtd_part *part) |
81 | +static void split_firmware(struct mtd_info *master, struct mtd_part *part) |
|
82 | +{ |
82 | +{ |
|
83 | +} |
83 | +} |
|
84 | + |
84 | + |
|
- | 85 | +void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, |
||
- | 86 | + int offset, int size) |
||
- | 87 | +{ |
||
- | 88 | +} |
||
- | 89 | + |
||
85 | +static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) |
90 | +static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) |
|
86 | +{ |
91 | +{ |
|
87 | + static int rootfs_found = 0; |
92 | + static int rootfs_found = 0; |
|
88 | + |
93 | + |
|
89 | + if (rootfs_found) |
94 | + if (rootfs_found) |
|
90 | + return; |
95 | + return; |
|
91 | + |
96 | + |
|
92 | + if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) && |
- | ||
93 | + !strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && |
97 | + if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && |
|
94 | + !of_find_property(mtd_get_of_node(&part->mtd), "compatible", NULL)) |
98 | + IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE)) |
|
95 | + split_firmware(master, part); |
99 | + split_firmware(master, part); |
|
96 | +} |
- | ||
97 | + |
100 | + |
|
- | 101 | + arch_split_mtd_part(master, part->mtd.name, part->offset, |
||
- | 102 | + part->mtd.size); |
||
- | 103 | +} |
||
98 | /* |
104 | /* |
|
99 | * This function, given a master MTD object and a partition table, creates |
105 | * This function, given a master MTD object and a partition table, creates |
|
100 | * and registers slave MTD objects which are bound to the master according to |
106 | * and registers slave MTD objects which are bound to the master according to |
|
101 | @@ -777,6 +805,7 @@ int add_mtd_partitions(struct mtd_info * |
107 | @@ -767,6 +801,7 @@ int add_mtd_partitions(struct mtd_info * |
|
102 | mutex_unlock(&mtd_partitions_mutex); |
108 | mutex_unlock(&mtd_partitions_mutex); |
|
Line 103... | Line 109... | |||
103 | |
109 | |
|
104 | add_mtd_device(&slave->mtd); |
110 | add_mtd_device(&slave->mtd); |
|
105 | + mtd_partition_split(master, slave); |
111 | + mtd_partition_split(master, slave); |
|
106 | mtd_add_partition_attrs(slave); |
112 | mtd_add_partition_attrs(slave); |
|
107 | /* Look for subpartitions */ |
113 | /* Look for subpartitions */ |
|
- | 114 | parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); |
||
- | 115 | --- a/include/linux/mtd/partitions.h |
||
- | 116 | +++ b/include/linux/mtd/partitions.h |
||
- | 117 | @@ -110,5 +110,7 @@ int mtd_add_partition(struct mtd_info *m |
||
- | 118 | long long offset, long long length); |
||
- | 119 | int mtd_del_partition(struct mtd_info *master, int partno); |
||
- | 120 | uint64_t mtd_get_device_size(const struct mtd_info *mtd); |
||
- | 121 | +extern void __weak arch_split_mtd_part(struct mtd_info *master, |
||
- | 122 | + const char *name, int offset, int size); |
||
- | 123 | |