mtd: nand: orion: use the mtd instance embedded in struct nand_chip
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Thu, 10 Dec 2015 08:00:17 +0000 (09:00 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Fri, 18 Dec 2015 18:54:41 +0000 (10:54 -0800)
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>
drivers/mtd/nand/orion_nand.c

index 4ed4f676ee05d961f1e63c3dccddfe01fe41e9e4..087a04024d6a0e23cb54aa0b1343e772805ceb9c 100644 (file)
@@ -85,11 +85,11 @@ static int __init orion_nand_probe(struct platform_device *pdev)
        u32 val = 0;
 
        nc = devm_kzalloc(&pdev->dev,
-                       sizeof(struct nand_chip) + sizeof(struct mtd_info),
+                       sizeof(struct nand_chip),
                        GFP_KERNEL);
        if (!nc)
                return -ENOMEM;
-       mtd = (struct mtd_info *)(nc + 1);
+       mtd = nand_to_mtd(nc);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        io_base = devm_ioremap_resource(&pdev->dev, res);