Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195944
b: refs/heads/master
c: 9d5da3a
h: refs/heads/master
v: v3
  • Loading branch information
Jason Gunthorpe authored and David Woodhouse committed May 13, 2010
1 parent 1110403 commit bb0e11a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2bfefa4c9632fb09bfe3277cf7b690818b147654
refs/heads/master: 9d5da3a9b849cf42fc165e90b1d39e2fd1e199a8
53 changes: 48 additions & 5 deletions trunk/drivers/mtd/maps/physmap_of.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,53 @@ static struct mtd_info * __devinit obsolete_probe(struct of_device *dev,
}
}

#ifdef CONFIG_MTD_PARTITIONS
/* When partitions are set we look for a linux,part-probe property which
specifies the list of partition probers to use. If none is given then the
default is use. These take precedence over other device tree
information. */
static const char *part_probe_types_def[] = { "cmdlinepart", "RedBoot", NULL };
static const char ** __devinit of_get_probes(struct device_node *dp)
{
const char *cp;
int cplen;
unsigned int l;
unsigned int count;
const char **res;

cp = of_get_property(dp, "linux,part-probe", &cplen);
if (cp == NULL)
return part_probe_types_def;

count = 0;
for (l = 0; l != cplen; l++)
if (cp[l] == 0)
count++;

res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL);
count = 0;
while (cplen > 0) {
res[count] = cp;
l = strlen(cp) + 1;
cp += l;
cplen -= l;
count++;
}
return res;
}

static void __devinit of_free_probes(const char **probes)
{
if (probes != part_probe_types_def)
kfree(probes);
}
#endif

static int __devinit of_flash_probe(struct of_device *dev,
const struct of_device_id *match)
{
#ifdef CONFIG_MTD_PARTITIONS
static const char *part_probe_types[]
= { "cmdlinepart", "RedBoot", NULL };
const char **part_probe_types;
#endif
struct device_node *dp = dev->node;
struct resource res;
Expand Down Expand Up @@ -307,12 +348,14 @@ static int __devinit of_flash_probe(struct of_device *dev,
goto err_out;

#ifdef CONFIG_MTD_PARTITIONS
/* First look for RedBoot table or partitions on the command
* line, these take precedence over device tree information */
part_probe_types = of_get_probes(dp);
err = parse_mtd_partitions(info->cmtd, part_probe_types,
&info->parts, 0);
if (err < 0)
if (err < 0) {
of_free_probes(part_probe_types);
return err;
}
of_free_probes(part_probe_types);

#ifdef CONFIG_MTD_OF_PARTS
if (err == 0) {
Expand Down

0 comments on commit bb0e11a

Please sign in to comment.