From patchwork Thu Dec 10 08:00:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 7815441 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 112FF9F1C2 for ; Thu, 10 Dec 2015 08:04:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1384D2056E for ; Thu, 10 Dec 2015 08:04:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 901942055D for ; Thu, 10 Dec 2015 08:04:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754988AbbLJIDv (ORCPT ); Thu, 10 Dec 2015 03:03:51 -0500 Received: from down.free-electrons.com ([37.187.137.238]:51762 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753606AbbLJIDs (ORCPT ); Thu, 10 Dec 2015 03:03:48 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id C756B3DCE; Thu, 10 Dec 2015 09:03:45 +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=unavailable version=3.3.1 Received: from localhost.localdomain (unknown [37.161.176.221]) by mail.free-electrons.com (Postfix) with ESMTPSA id DC60E231A; Thu, 10 Dec 2015 09:02:17 +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 24/58] mtd: nand: hisi504: use the mtd instance embedded in struct nand_chip Date: Thu, 10 Dec 2015 09:00:08 +0100 Message-Id: <1449734442-18672-25-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 --- Changes generated with the following coccinelle script --->8--- virtual patch @fix1@ identifier __chipfield, __mtdfield; type __type; @@ ( __type { ... struct nand_chip __chipfield; ... - struct mtd_info __mtdfield; ... }; | __type { ... - struct mtd_info __mtdfield; ... struct nand_chip __chipfield; ... }; ) @fix2 depends on fix1@ identifier fix1.__chipfield, fix1.__mtdfield; identifier __subfield; type fix1.__type; __type *__priv; @@ ( - __priv->__mtdfield.__subfield + nand_to_mtd(&__priv->__chipfield)->__subfield | - &(__priv->__mtdfield) + nand_to_mtd(&__priv->__chipfield) ) --->8--- --- drivers/mtd/nand/hisi504_nand.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/hisi504_nand.c b/drivers/mtd/nand/hisi504_nand.c index 6358d4a..6e6e482 100644 --- a/drivers/mtd/nand/hisi504_nand.c +++ b/drivers/mtd/nand/hisi504_nand.c @@ -134,7 +134,6 @@ struct hinfc_host { struct nand_chip chip; - struct mtd_info mtd; struct device *dev; void __iomem *iobase; void __iomem *mmio; @@ -189,8 +188,8 @@ static void wait_controller_finished(struct hinfc_host *host) static void hisi_nfc_dma_transfer(struct hinfc_host *host, int todev) { - struct mtd_info *mtd = &host->mtd; - struct nand_chip *chip = mtd_to_nand(mtd); + struct nand_chip *chip = &host->chip; + struct mtd_info *mtd = nand_to_mtd(chip); unsigned long val; int ret; @@ -262,7 +261,7 @@ static int hisi_nfc_send_cmd_pageprog(struct hinfc_host *host) static int hisi_nfc_send_cmd_readstart(struct hinfc_host *host) { - struct mtd_info *mtd = &host->mtd; + struct mtd_info *mtd = nand_to_mtd(&host->chip); if ((host->addr_value[0] == host->cache_addr_value[0]) && (host->addr_value[1] == host->cache_addr_value[1])) @@ -643,7 +642,7 @@ static int hisi_nfc_ecc_probe(struct hinfc_host *host) int size, strength, ecc_bits; struct device *dev = host->dev; struct nand_chip *chip = &host->chip; - struct mtd_info *mtd = &host->mtd; + struct mtd_info *mtd = nand_to_mtd(chip); struct device_node *np = host->dev->of_node; size = of_get_nand_ecc_step_size(np); @@ -712,7 +711,7 @@ static int hisi_nfc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, host); chip = &host->chip; - mtd = &host->mtd; + mtd = nand_to_mtd(chip); irq = platform_get_irq(pdev, 0); if (irq < 0) { @@ -822,7 +821,7 @@ err_res: static int hisi_nfc_remove(struct platform_device *pdev) { struct hinfc_host *host = platform_get_drvdata(pdev); - struct mtd_info *mtd = &host->mtd; + struct mtd_info *mtd = nand_to_mtd(&host->chip); nand_release(mtd);