From patchwork Thu Dec 10 08:00:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 7816341 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6B09ABEEE1 for ; Thu, 10 Dec 2015 08:14:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D87120555 for ; Thu, 10 Dec 2015 08:14:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 829DD20389 for ; Thu, 10 Dec 2015 08:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755182AbbLJIIO (ORCPT ); Thu, 10 Dec 2015 03:08:14 -0500 Received: from down.free-electrons.com ([37.187.137.238]:52270 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752762AbbLJIH0 (ORCPT ); Thu, 10 Dec 2015 03:07:26 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 1AABD426E; Thu, 10 Dec 2015 09:07:23 +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 EA1D23D3C; Thu, 10 Dec 2015 09:03:14 +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 39/58] mtd: nand: sh_flctl: use the mtd instance embedded in struct nand_chip Date: Thu, 10 Dec 2015 09:00:23 +0100 Message-Id: <1449734442-18672-40-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/sh_flctl.c | 8 ++++---- include/linux/mtd/sh_flctl.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c index 57dc525..0ec4b04 100644 --- a/drivers/mtd/nand/sh_flctl.c +++ b/drivers/mtd/nand/sh_flctl.c @@ -607,13 +607,13 @@ static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr) case FL_REPAIRABLE: dev_info(&flctl->pdev->dev, "applied ecc on page 0x%x", page_addr); - flctl->mtd.ecc_stats.corrected++; + mtd->ecc_stats.corrected++; break; case FL_ERROR: dev_warn(&flctl->pdev->dev, "page 0x%x contains corrupted data\n", page_addr); - flctl->mtd.ecc_stats.failed++; + mtd->ecc_stats.failed++; break; default: ; @@ -1120,8 +1120,8 @@ static int flctl_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, flctl); - flctl_mtd = &flctl->mtd; nand = &flctl->chip; + flctl_mtd = nand_to_mtd(nand); nand_set_flash_node(nand, pdev->dev.of_node); flctl_mtd->priv = nand; flctl_mtd->dev.parent = &pdev->dev; @@ -1178,7 +1178,7 @@ static int flctl_remove(struct platform_device *pdev) struct sh_flctl *flctl = platform_get_drvdata(pdev); flctl_release_dma(flctl); - nand_release(&flctl->mtd); + nand_release(nand_to_mtd(&flctl->chip)); pm_runtime_disable(&pdev->dev); return 0; diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h index 1c28f88..76e3e88 100644 --- a/include/linux/mtd/sh_flctl.h +++ b/include/linux/mtd/sh_flctl.h @@ -143,7 +143,6 @@ enum flctl_ecc_res_t { struct dma_chan; struct sh_flctl { - struct mtd_info mtd; struct nand_chip chip; struct platform_device *pdev; struct dev_pm_qos_request pm_qos; @@ -186,7 +185,7 @@ struct sh_flctl_platform_data { static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) { - return container_of(mtdinfo, struct sh_flctl, mtd); + return container_of(mtd_to_nand(mtdinfo), struct sh_flctl, chip); } #endif /* __SH_FLCTL_H__ */