diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-05-22 02:36:56 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-05-22 02:36:56 -0400 |
commit | cf9b59e9d3e008591d1f54830f570982bb307a0d (patch) | |
tree | 113478ce8fd8c832ba726ffdf59b82cb46356476 /drivers/mtd/maps/physmap_of.c | |
parent | 44504b2bebf8b5823c59484e73096a7d6574471d (diff) | |
parent | f4b87dee923342505e1ddba8d34ce9de33e75050 (diff) |
Merge remote branch 'origin' into secretlab/next-devicetree
Merging in current state of Linus' tree to deal with merge conflicts and
build failures in vio.c after merge.
Conflicts:
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-mpc.c
drivers/net/gianfar.c
Also fixed up one line in arch/powerpc/kernel/vio.c to use the
correct node pointer.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/mtd/maps/physmap_of.c')
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 4147fe328c55..ba124baa646d 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -173,12 +173,53 @@ static struct mtd_info * __devinit obsolete_probe(struct of_device *dev, | |||
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | #ifdef CONFIG_MTD_PARTITIONS | ||
177 | /* When partitions are set we look for a linux,part-probe property which | ||
178 | specifies the list of partition probers to use. If none is given then the | ||
179 | default is use. These take precedence over other device tree | ||
180 | information. */ | ||
181 | static const char *part_probe_types_def[] = { "cmdlinepart", "RedBoot", NULL }; | ||
182 | static const char ** __devinit of_get_probes(struct device_node *dp) | ||
183 | { | ||
184 | const char *cp; | ||
185 | int cplen; | ||
186 | unsigned int l; | ||
187 | unsigned int count; | ||
188 | const char **res; | ||
189 | |||
190 | cp = of_get_property(dp, "linux,part-probe", &cplen); | ||
191 | if (cp == NULL) | ||
192 | return part_probe_types_def; | ||
193 | |||
194 | count = 0; | ||
195 | for (l = 0; l != cplen; l++) | ||
196 | if (cp[l] == 0) | ||
197 | count++; | ||
198 | |||
199 | res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL); | ||
200 | count = 0; | ||
201 | while (cplen > 0) { | ||
202 | res[count] = cp; | ||
203 | l = strlen(cp) + 1; | ||
204 | cp += l; | ||
205 | cplen -= l; | ||
206 | count++; | ||
207 | } | ||
208 | return res; | ||
209 | } | ||
210 | |||
211 | static void __devinit of_free_probes(const char **probes) | ||
212 | { | ||
213 | if (probes != part_probe_types_def) | ||
214 | kfree(probes); | ||
215 | } | ||
216 | #endif | ||
217 | |||
176 | static int __devinit of_flash_probe(struct of_device *dev, | 218 | static int __devinit of_flash_probe(struct of_device *dev, |
177 | const struct of_device_id *match) | 219 | const struct of_device_id *match) |
178 | { | 220 | { |
179 | #ifdef CONFIG_MTD_PARTITIONS | 221 | #ifdef CONFIG_MTD_PARTITIONS |
180 | static const char *part_probe_types[] | 222 | const char **part_probe_types; |
181 | = { "cmdlinepart", "RedBoot", NULL }; | ||
182 | #endif | 223 | #endif |
183 | struct device_node *dp = dev->dev.of_node; | 224 | struct device_node *dp = dev->dev.of_node; |
184 | struct resource res; | 225 | struct resource res; |
@@ -218,7 +259,7 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
218 | 259 | ||
219 | dev_set_drvdata(&dev->dev, info); | 260 | dev_set_drvdata(&dev->dev, info); |
220 | 261 | ||
221 | mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); | 262 | mtd_list = kzalloc(sizeof(*mtd_list) * count, GFP_KERNEL); |
222 | if (!mtd_list) | 263 | if (!mtd_list) |
223 | goto err_flash_remove; | 264 | goto err_flash_remove; |
224 | 265 | ||
@@ -307,12 +348,14 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
307 | goto err_out; | 348 | goto err_out; |
308 | 349 | ||
309 | #ifdef CONFIG_MTD_PARTITIONS | 350 | #ifdef CONFIG_MTD_PARTITIONS |
310 | /* First look for RedBoot table or partitions on the command | 351 | part_probe_types = of_get_probes(dp); |
311 | * line, these take precedence over device tree information */ | ||
312 | err = parse_mtd_partitions(info->cmtd, part_probe_types, | 352 | err = parse_mtd_partitions(info->cmtd, part_probe_types, |
313 | &info->parts, 0); | 353 | &info->parts, 0); |
314 | if (err < 0) | 354 | if (err < 0) { |
355 | of_free_probes(part_probe_types); | ||
315 | return err; | 356 | return err; |
357 | } | ||
358 | of_free_probes(part_probe_types); | ||
316 | 359 | ||
317 | #ifdef CONFIG_MTD_OF_PARTS | 360 | #ifdef CONFIG_MTD_OF_PARTS |
318 | if (err == 0) { | 361 | if (err == 0) { |