提交 e787dfd1 编写于 作者: B Boris BREZILLON 提交者: Brian Norris

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: NBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
上级 f1c4c999
...@@ -605,11 +605,11 @@ static int cafe_nand_probe(struct pci_dev *pdev, ...@@ -605,11 +605,11 @@ static int cafe_nand_probe(struct pci_dev *pdev,
pci_set_master(pdev); pci_set_master(pdev);
mtd = kzalloc(sizeof(*mtd) + sizeof(struct cafe_priv), GFP_KERNEL); cafe = kzalloc(sizeof(*cafe), GFP_KERNEL);
if (!mtd) if (!cafe)
return -ENOMEM; return -ENOMEM;
cafe = (void *)(&mtd[1]);
mtd = nand_to_mtd(&cafe->nand);
mtd->dev.parent = &pdev->dev; mtd->dev.parent = &pdev->dev;
mtd->priv = &cafe->nand; mtd->priv = &cafe->nand;
cafe->nand.priv = cafe; cafe->nand.priv = cafe;
...@@ -792,7 +792,7 @@ static int cafe_nand_probe(struct pci_dev *pdev, ...@@ -792,7 +792,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
out_ior: out_ior:
pci_iounmap(pdev, cafe->mmio); pci_iounmap(pdev, cafe->mmio);
out_free_mtd: out_free_mtd:
kfree(mtd); kfree(cafe);
out: out:
return err; return err;
} }
...@@ -813,7 +813,7 @@ static void cafe_nand_remove(struct pci_dev *pdev) ...@@ -813,7 +813,7 @@ static void cafe_nand_remove(struct pci_dev *pdev)
2112 + sizeof(struct nand_buffers) + 2112 + sizeof(struct nand_buffers) +
mtd->writesize + mtd->oobsize, mtd->writesize + mtd->oobsize,
cafe->dmabuf, cafe->dmaaddr); cafe->dmabuf, cafe->dmaaddr);
kfree(mtd); kfree(cafe);
} }
static const struct pci_device_id cafe_nand_tbl[] = { static const struct pci_device_id cafe_nand_tbl[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册