Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755200AbbLJIGx (ORCPT ); Thu, 10 Dec 2015 03:06:53 -0500 Received: from down.free-electrons.com ([37.187.137.238]:52113 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754869AbbLJIGt (ORCPT ); Thu, 10 Dec 2015 03:06:49 -0500 From: Boris Brezillon To: David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, Hartley Sweeten , Ryan Mallon , Shawn Guo , Sascha Hauer , Imre Kaloz , Krzysztof Halasa , Tony Lindgren , linux-omap@vger.kernel.org, Alexander Clouter , Thomas Petazzoni , Gregory CLEMENT , Jason Cooper , Sebastian Hesselbarth , Andrew Lunn , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Marek Vasut , Steven Miao , adi-buildroot-devel@lists.sourceforge.net, Mikael Starvik , Jesper Nilsson , linux-cris-kernel@axis.com, Josh Wu , Wan ZongShun , Ezequiel Garcia , Maxim Levitsky , Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, Maxime Ripard , Chen-Yu Tsai , linux-sunxi@googlegroups.com, Stefan Agner , Greg Kroah-Hartman , devel@driverdev.osuosl.org, Boris Brezillon Subject: [PATCH v4 34/58] mtd: nand: pasemi: use the mtd instance embedded in struct nand_chip Date: Thu, 10 Dec 2015 09:00:18 +0100 Message-Id: <1449734442-18672-35-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449734442-18672-1-git-send-email-boris.brezillon@free-electrons.com> References: <1449734442-18672-1-git-send-email-boris.brezillon@free-electrons.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1828 Lines: 58 struct nand_chip now embeds an mtd device. Make use of this mtd instance. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/pasemi_nand.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c index 0ececac..4dd2985 100644 --- a/drivers/mtd/nand/pasemi_nand.c +++ b/drivers/mtd/nand/pasemi_nand.c @@ -110,17 +110,15 @@ static int pasemi_nand_probe(struct platform_device *ofdev) pr_debug("pasemi_nand at %pR\n", &res); /* Allocate memory for MTD device structure and private data */ - pasemi_nand_mtd = kzalloc(sizeof(struct mtd_info) + - sizeof(struct nand_chip), GFP_KERNEL); - if (!pasemi_nand_mtd) { + chip = kzalloc(sizeof(struct nand_chip), GFP_KERNEL); + if (!chip) { printk(KERN_WARNING "Unable to allocate PASEMI NAND MTD device structure\n"); err = -ENOMEM; goto out; } - /* Get pointer to private data */ - chip = (struct nand_chip *)&pasemi_nand_mtd[1]; + pasemi_nand_mtd = nand_to_mtd(chip); /* Link the private data with the MTD structure */ pasemi_nand_mtd->priv = chip; @@ -180,7 +178,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev) out_ior: iounmap(chip->IO_ADDR_R); out_mtd: - kfree(pasemi_nand_mtd); + kfree(chip); out: return err; } @@ -202,7 +200,7 @@ static int pasemi_nand_remove(struct platform_device *ofdev) iounmap(chip->IO_ADDR_R); /* Free the MTD device structure */ - kfree(pasemi_nand_mtd); + kfree(chip); pasemi_nand_mtd = NULL; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/