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

Commit 4e3b6d17 authored by Boris Brezillon's avatar Boris Brezillon Committed by Brian Norris
Browse files

mtd: nand: pasemi: 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: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 53cd2681
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -110,17 +110,15 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
	pr_debug("pasemi_nand at %pR\n", &res);
	pr_debug("pasemi_nand at %pR\n", &res);


	/* Allocate memory for MTD device structure and private data */
	/* Allocate memory for MTD device structure and private data */
	pasemi_nand_mtd = kzalloc(sizeof(struct mtd_info) +
	chip = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
				  sizeof(struct nand_chip), GFP_KERNEL);
	if (!chip) {
	if (!pasemi_nand_mtd) {
		printk(KERN_WARNING
		printk(KERN_WARNING
		       "Unable to allocate PASEMI NAND MTD device structure\n");
		       "Unable to allocate PASEMI NAND MTD device structure\n");
		err = -ENOMEM;
		err = -ENOMEM;
		goto out;
		goto out;
	}
	}


	/* Get pointer to private data */
	pasemi_nand_mtd = nand_to_mtd(chip);
	chip = (struct nand_chip *)&pasemi_nand_mtd[1];


	/* Link the private data with the MTD structure */
	/* Link the private data with the MTD structure */
	pasemi_nand_mtd->priv = chip;
	pasemi_nand_mtd->priv = chip;
@@ -180,7 +178,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
 out_ior:
 out_ior:
	iounmap(chip->IO_ADDR_R);
	iounmap(chip->IO_ADDR_R);
 out_mtd:
 out_mtd:
	kfree(pasemi_nand_mtd);
	kfree(chip);
 out:
 out:
	return err;
	return err;
}
}
@@ -202,7 +200,7 @@ static int pasemi_nand_remove(struct platform_device *ofdev)
	iounmap(chip->IO_ADDR_R);
	iounmap(chip->IO_ADDR_R);


	/* Free the MTD device structure */
	/* Free the MTD device structure */
	kfree(pasemi_nand_mtd);
	kfree(chip);


	pasemi_nand_mtd = NULL;
	pasemi_nand_mtd = NULL;