Commit 9e58c5d4 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Artem Bityutskiy

mtd: txx9ndfmc.c: use mtd_device_parse_register

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: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 68adef5d
...@@ -74,7 +74,6 @@ struct txx9ndfmc_drvdata { ...@@ -74,7 +74,6 @@ 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;
struct mtd_partition *parts[MAX_TXX9NDFMC_DEV];
}; };
static struct platform_device *mtd_to_platdev(struct mtd_info *mtd) static struct platform_device *mtd_to_platdev(struct mtd_info *mtd)
...@@ -332,7 +331,6 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) ...@@ -332,7 +331,6 @@ 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;
int nr_parts;
if (!(plat->ch_mask & (1 << i))) if (!(plat->ch_mask & (1 << i)))
continue; continue;
...@@ -392,9 +390,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) ...@@ -392,9 +390,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
} }
mtd->name = txx9_priv->mtdname; mtd->name = txx9_priv->mtdname;
nr_parts = parse_mtd_partitions(mtd, NULL, mtd_device_parse_register(mtd, NULL, 0, NULL, 0);
&drvdata->parts[i], 0);
mtd_device_register(mtd, drvdata->parts[i], nr_parts);
drvdata->mtds[i] = mtd; drvdata->mtds[i] = mtd;
} }
...@@ -420,7 +416,6 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) ...@@ -420,7 +416,6 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev)
txx9_priv = chip->priv; txx9_priv = chip->priv;
nand_release(mtd); nand_release(mtd);
kfree(drvdata->parts[i]);
kfree(txx9_priv->mtdname); kfree(txx9_priv->mtdname);
kfree(txx9_priv); kfree(txx9_priv);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment