Skip to content

Commit

Permalink
mtd: plat_nand: convert to mtd_device_register()
Browse files Browse the repository at this point in the history
Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Jamie Iles authored and David Woodhouse committed May 25, 2011
1 parent 5ffcaf3 commit 3ee904f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions drivers/mtd/nand/plat_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ struct plat_nand_data {
struct nand_chip chip;
struct mtd_info mtd;
void __iomem *io_base;
#ifdef CONFIG_MTD_PARTITIONS
int nr_parts;
struct mtd_partition *parts;
#endif
};

/*
Expand Down Expand Up @@ -101,25 +99,23 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
goto out;
}

#ifdef CONFIG_MTD_PARTITIONS
if (pdata->chip.part_probe_types) {
err = parse_mtd_partitions(&data->mtd,
pdata->chip.part_probe_types,
&data->parts, 0);
if (err > 0) {
add_mtd_partitions(&data->mtd, data->parts, err);
mtd_device_register(&data->mtd, data->parts, err);
return 0;
}
}
if (pdata->chip.set_parts)
pdata->chip.set_parts(data->mtd.size, &pdata->chip);
if (pdata->chip.partitions) {
data->parts = pdata->chip.partitions;
err = add_mtd_partitions(&data->mtd, data->parts,
err = mtd_device_register(&data->mtd, data->parts,
pdata->chip.nr_partitions);
} else
#endif
err = add_mtd_device(&data->mtd);
err = mtd_device_register(&data->mtd, NULL, 0);

if (!err)
return err;
Expand Down Expand Up @@ -149,10 +145,8 @@ static int __devexit plat_nand_remove(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

nand_release(&data->mtd);
#ifdef CONFIG_MTD_PARTITIONS
if (data->parts && data->parts != pdata->chip.partitions)
kfree(data->parts);
#endif
if (pdata->ctrl.remove)
pdata->ctrl.remove(pdev);
iounmap(data->io_base);
Expand Down

0 comments on commit 3ee904f

Please sign in to comment.