From patchwork Thu Dec 10 07:59:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 7816921 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 38CB99F1C2 for ; Thu, 10 Dec 2015 08:21:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 540712056E for ; Thu, 10 Dec 2015 08:21:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55D46203DF for ; Thu, 10 Dec 2015 08:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754824AbbLJIB5 (ORCPT ); Thu, 10 Dec 2015 03:01:57 -0500 Received: from down.free-electrons.com ([37.187.137.238]:51334 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754517AbbLJIBw (ORCPT ); Thu, 10 Dec 2015 03:01:52 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id D03932415; Thu, 10 Dec 2015 09:01:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from localhost.localdomain (unknown [37.161.176.221]) by mail.free-electrons.com (Postfix) with ESMTPSA id 114B2240A; Thu, 10 Dec 2015 09:01:35 +0100 (CET) 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 13/58] mtd: nand: cs553x: use the mtd instance embedded in struct nand_chip Date: Thu, 10 Dec 2015 08:59:57 +0100 Message-Id: <1449734442-18672-14-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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct nand_chip now embeds an mtd device. Make use of this mtd instance. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/cs553x_nand.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c index 8904d68..386ae83 100644 --- a/drivers/mtd/nand/cs553x_nand.c +++ b/drivers/mtd/nand/cs553x_nand.c @@ -197,14 +197,13 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) } /* Allocate memory for MTD device structure and private data */ - new_mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); - if (!new_mtd) { + this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL); + if (!this) { err = -ENOMEM; goto out; } - /* Get pointer to private data */ - this = (struct nand_chip *)(&new_mtd[1]); + new_mtd = nand_to_mtd(this); /* Link the private data with the MTD structure */ new_mtd->priv = this; @@ -257,7 +256,7 @@ out_free: out_ior: iounmap(this->IO_ADDR_R); out_mtd: - kfree(new_mtd); + kfree(this); out: return err; } @@ -337,19 +336,19 @@ static void __exit cs553x_cleanup(void) if (!mtd) continue; - this = mtd_to_nand(cs553x_mtd[i]); + this = mtd_to_nand(mtd); mmio_base = this->IO_ADDR_R; /* Release resources, unregister device */ - nand_release(cs553x_mtd[i]); - kfree(cs553x_mtd[i]->name); + nand_release(mtd); + kfree(mtd->name); cs553x_mtd[i] = NULL; /* unmap physical address */ iounmap(mmio_base); /* Free the MTD device structure */ - kfree(mtd); + kfree(this); } }