Skip to content

Commit

Permalink
mtd: onenand/generic.c: use mtd_device_parse_register
Browse files Browse the repository at this point in the history
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
  • Loading branch information
Dmitry Eremin-Solenikov authored and Artem Bityutskiy committed Sep 11, 2011
1 parent 9e58c5d commit 92ffb00
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/mtd/onenand/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

struct onenand_info {
struct mtd_info mtd;
struct mtd_partition *parts;
struct onenand_chip onenand;
};

Expand Down Expand Up @@ -71,13 +70,9 @@ static int __devinit generic_onenand_probe(struct platform_device *pdev)
goto out_iounmap;
}

err = parse_mtd_partitions(&info->mtd, NULL, &info->parts, 0);
if (err > 0)
mtd_device_register(&info->mtd, info->parts, err);
else if (err <= 0 && pdata && pdata->parts)
mtd_device_register(&info->mtd, pdata->parts, pdata->nr_parts);
else
err = mtd_device_register(&info->mtd, NULL, 0);
err = mtd_device_parse_register(&info->mtd, NULL, 0,
pdata ? pdata->parts : NULL,
pdata ? pdata->nr_parts : 0);

platform_set_drvdata(pdev, info);

Expand Down

0 comments on commit 92ffb00

Please sign in to comment.