2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 16:53:54 +08:00

mtd: txx9ndfmc: convert to mtd_device_register()

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>
This commit is contained in:
Jamie Iles 2011-05-23 10:23:37 +01:00 committed by David Woodhouse
parent d1e084e663
commit c52840f878

View File

@ -74,9 +74,7 @@ struct txx9ndfmc_drvdata {
unsigned char hold; /* in gbusclock */ unsigned char hold; /* in gbusclock */
unsigned char spw; /* in gbusclock */ unsigned char spw; /* in gbusclock */
struct nand_hw_control hw_control; struct nand_hw_control hw_control;
#ifdef CONFIG_MTD_PARTITIONS
struct mtd_partition *parts[MAX_TXX9NDFMC_DEV]; struct mtd_partition *parts[MAX_TXX9NDFMC_DEV];
#endif
}; };
static struct platform_device *mtd_to_platdev(struct mtd_info *mtd) static struct platform_device *mtd_to_platdev(struct mtd_info *mtd)
@ -289,9 +287,7 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd)
static int __init txx9ndfmc_probe(struct platform_device *dev) static int __init txx9ndfmc_probe(struct platform_device *dev)
{ {
struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; struct txx9ndfmc_platform_data *plat = dev->dev.platform_data;
#ifdef CONFIG_MTD_PARTITIONS
static const char *probes[] = { "cmdlinepart", NULL }; static const char *probes[] = { "cmdlinepart", NULL };
#endif
int hold, spw; int hold, spw;
int i; int i;
struct txx9ndfmc_drvdata *drvdata; struct txx9ndfmc_drvdata *drvdata;
@ -337,9 +333,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
struct txx9ndfmc_priv *txx9_priv; struct txx9ndfmc_priv *txx9_priv;
struct nand_chip *chip; struct nand_chip *chip;
struct mtd_info *mtd; struct mtd_info *mtd;
#ifdef CONFIG_MTD_PARTITIONS
int nr_parts; int nr_parts;
#endif
if (!(plat->ch_mask & (1 << i))) if (!(plat->ch_mask & (1 << i)))
continue; continue;
@ -399,13 +393,9 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
} }
mtd->name = txx9_priv->mtdname; mtd->name = txx9_priv->mtdname;
#ifdef CONFIG_MTD_PARTITIONS
nr_parts = parse_mtd_partitions(mtd, probes, nr_parts = parse_mtd_partitions(mtd, probes,
&drvdata->parts[i], 0); &drvdata->parts[i], 0);
if (nr_parts > 0) mtd_device_register(mtd, drvdata->parts[i], nr_parts);
add_mtd_partitions(mtd, drvdata->parts[i], nr_parts);
#endif
add_mtd_device(mtd);
drvdata->mtds[i] = mtd; drvdata->mtds[i] = mtd;
} }
@ -431,9 +421,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev)
txx9_priv = chip->priv; txx9_priv = chip->priv;
nand_release(mtd); nand_release(mtd);
#ifdef CONFIG_MTD_PARTITIONS
kfree(drvdata->parts[i]); kfree(drvdata->parts[i]);
#endif
kfree(txx9_priv->mtdname); kfree(txx9_priv->mtdname);
kfree(txx9_priv); kfree(txx9_priv);
} }