summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/cafe_nand.c
diff options
context:
space:
mode:
authorBoris BREZILLON <boris.brezillon@free-electrons.com>2015-12-10 08:59:55 +0100
committerBrian Norris <computersforpeace@gmail.com>2015-12-18 19:25:07 +0100
commite787dfd1be424e0546d05d6819c8ab9c222ec248 (patch)
tree12ab3e9a58d35bab470d381f0007ab0885746c14 /drivers/mtd/nand/cafe_nand.c
parentmtd: nand: brcm: use the mtd instance embedded in struct nand_chip (diff)
downloadlinux-e787dfd1be424e0546d05d6819c8ab9c222ec248.tar.xz
linux-e787dfd1be424e0546d05d6819c8ab9c222ec248.zip
mtd: nand: cafe: use the mtd instance embedded in struct nand_chip
struct nand_chip now embeds an mtd device. Make use of this mtd instance. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/cafe_nand.c')
-rw-r--r--drivers/mtd/nand/cafe_nand.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 77c92f1b985f..7d6a14218bef 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -605,11 +605,11 @@ static int cafe_nand_probe(struct pci_dev *pdev,
pci_set_master(pdev);
- mtd = kzalloc(sizeof(*mtd) + sizeof(struct cafe_priv), GFP_KERNEL);
- if (!mtd)
+ cafe = kzalloc(sizeof(*cafe), GFP_KERNEL);
+ if (!cafe)
return -ENOMEM;
- cafe = (void *)(&mtd[1]);
+ mtd = nand_to_mtd(&cafe->nand);
mtd->dev.parent = &pdev->dev;
mtd->priv = &cafe->nand;
cafe->nand.priv = cafe;
@@ -792,7 +792,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
out_ior:
pci_iounmap(pdev, cafe->mmio);
out_free_mtd:
- kfree(mtd);
+ kfree(cafe);
out:
return err;
}
@@ -813,7 +813,7 @@ static void cafe_nand_remove(struct pci_dev *pdev)
2112 + sizeof(struct nand_buffers) +
mtd->writesize + mtd->oobsize,
cafe->dmabuf, cafe->dmaaddr);
- kfree(mtd);
+ kfree(cafe);
}
static const struct pci_device_id cafe_nand_tbl[] = {