Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46720bbf authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse
Browse files

mtd: cafe_nand: 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: default avatarJamie Iles <jamie@jamieiles.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 88146872
Loading
Loading
Loading
Loading
+2 −9
Original line number Original line Diff line number Diff line
@@ -90,9 +90,7 @@ static unsigned int numtimings;
static int timing[3];
static int timing[3];
module_param_array(timing, int, &numtimings, 0644);
module_param_array(timing, int, &numtimings, 0644);


#ifdef CONFIG_MTD_PARTITIONS
static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
#endif


/* Hrm. Why isn't this already conditional on something in the struct device? */
/* Hrm. Why isn't this already conditional on something in the struct device? */
#define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0)
#define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0)
@@ -632,10 +630,8 @@ 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;
#ifdef CONFIG_MTD_PARTITIONS
	struct mtd_partition *parts;
	struct mtd_partition *parts;
	int nr_parts;
	int nr_parts;
#endif


	/* 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... */
@@ -804,9 +800,8 @@ 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 */
	/* We register the whole device first, separate from the partitions */
	add_mtd_device(mtd);
	mtd_device_register(mtd, NULL, 0);


#ifdef CONFIG_MTD_PARTITIONS
#ifdef CONFIG_MTD_CMDLINE_PARTS
#ifdef CONFIG_MTD_CMDLINE_PARTS
	mtd->name = "cafe_nand";
	mtd->name = "cafe_nand";
#endif
#endif
@@ -814,9 +809,8 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
	if (nr_parts > 0) {
	if (nr_parts > 0) {
		cafe->parts = parts;
		cafe->parts = parts;
		dev_info(&cafe->pdev->dev, "%d partitions found\n", nr_parts);
		dev_info(&cafe->pdev->dev, "%d partitions found\n", nr_parts);
		add_mtd_partitions(mtd, parts, nr_parts);
		mtd_device_register(mtd, parts, nr_parts);
	}
	}
#endif
	goto out;
	goto out;


 out_irq:
 out_irq:
@@ -838,7 +832,6 @@ static void __devexit cafe_nand_remove(struct pci_dev *pdev)
	struct mtd_info *mtd = pci_get_drvdata(pdev);
	struct mtd_info *mtd = pci_get_drvdata(pdev);
	struct cafe_priv *cafe = mtd->priv;
	struct cafe_priv *cafe = mtd->priv;


	del_mtd_device(mtd);
	/* Disable NAND IRQ in global IRQ mask register */
	/* Disable NAND IRQ in global IRQ mask register */
	cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
	cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
	free_irq(pdev->irq, mtd);
	free_irq(pdev->irq, mtd);