Commit 4d32de81 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Artem Bityutskiy

mtd: cafe_nand.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.

Fixed by Brian Norris <computersforpeace@gmail.com>
Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 58171cb1
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
struct cafe_priv { struct cafe_priv {
struct nand_chip nand; struct nand_chip nand;
struct mtd_partition *parts;
struct pci_dev *pdev; struct pci_dev *pdev;
void __iomem *mmio; void __iomem *mmio;
struct rs_control *rs; struct rs_control *rs;
...@@ -630,8 +629,6 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, ...@@ -630,8 +629,6 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
struct cafe_priv *cafe; struct cafe_priv *cafe;
uint32_t ctrl; uint32_t ctrl;
int err = 0; int err = 0;
struct mtd_partition *parts;
int nr_parts;
/* Very old versions shared the same PCI ident for all three /* Very old versions shared the same PCI ident for all three
functions on the chip. Verify the class too... */ functions on the chip. Verify the class too... */
...@@ -800,16 +797,9 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, ...@@ -800,16 +797,9 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, mtd); pci_set_drvdata(pdev, mtd);
/* We register the whole device first, separate from the partitions */
mtd_device_register(mtd, NULL, 0);
mtd->name = "cafe_nand"; mtd->name = "cafe_nand";
nr_parts = parse_mtd_partitions(mtd, part_probes, &parts, 0); mtd_device_parse_register(mtd, part_probes, 0, NULL, 0);
if (nr_parts > 0) {
cafe->parts = parts;
dev_info(&cafe->pdev->dev, "%d partitions found\n", nr_parts);
mtd_device_register(mtd, parts, nr_parts);
}
goto out; goto out;
out_irq: out_irq:
......
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