From patchwork Fri Dec 18 19:38:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 7887521 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 1C4AFBEEE5 for ; Fri, 18 Dec 2015 19:38:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3667C20503 for ; Fri, 18 Dec 2015 19:38:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CB99204E7 for ; Fri, 18 Dec 2015 19:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965017AbbLRTim (ORCPT ); Fri, 18 Dec 2015 14:38:42 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34215 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933011AbbLRTil (ORCPT ); Fri, 18 Dec 2015 14:38:41 -0500 Received: by mail-pa0-f50.google.com with SMTP id wq6so65010481pac.1 for ; Fri, 18 Dec 2015 11:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Nrq8CgoeHf60i/pgn2US7mQoXif56fPXYMZrHRTZkp8=; b=pmL8lKFlQnXi+wCA8dCNDzpu4hwNyKkMo/NhsOOfU31wU2tk7BJRkEJVj1pw0WzQLP oQJZQ/AD09iyDnueULbpjU2NpjDYNeeLIBSm8DwMoDIKZ+YpPyijyMWzzF/TNONFDcg2 96wFiC2E5Wd+W6Ej9yK7Oy86jiabRZFmAWRt2sFcvXD15UyuPYE35bmtrxn2XcGinsNU On3M9auNduopEhv3o/s5Tx/pcd8JnazXtY6rmVf3mNjpET2ofxpHyvjKYftCxkeCyEkE Y2ViuRRT1lfFN9kE9iX070W3jVNvZno/syirNMDXXnrgnfGSt4jJNBkBSQN+sOPnOV2B 0pkQ== X-Received: by 10.66.150.37 with SMTP id uf5mr8073751pab.30.1450467520755; Fri, 18 Dec 2015 11:38:40 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id xi8sm23972250pab.9.2015.12.18.11.38.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 11:38:40 -0800 (PST) From: Brian Norris To: Cc: Boris Brezillon , Brian Norris , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , linux-wireless@vger.kernel.org Subject: [PATCH v5] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip Date: Fri, 18 Dec 2015 11:38:18 -0800 Message-Id: <1450467498-35553-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Boris BREZILLON struct nand_chip now embeds an mtd device. Make use of this mtd instance. Signed-off-by: Boris Brezillon Signed-off-by: Brian Norris Acked-by: Boris Brezillon --- Rebased Boris's patch to l2-mtd.git drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h | 1 - drivers/mtd/nand/bcm47xxnflash/main.c | 10 ++++++---- drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h index c005a62330b1..8ea75710a854 100644 --- a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h +++ b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h @@ -12,7 +12,6 @@ struct bcm47xxnflash { struct bcma_drv_cc *cc; struct nand_chip nand_chip; - struct mtd_info mtd; unsigned curr_command; int curr_page_addr; diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c index 0b3acc439181..2c9bffb614c5 100644 --- a/drivers/mtd/nand/bcm47xxnflash/main.c +++ b/drivers/mtd/nand/bcm47xxnflash/main.c @@ -27,6 +27,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev) { struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev); struct bcm47xxnflash *b47n; + struct mtd_info *mtd; int err = 0; b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL); @@ -34,8 +35,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev) return -ENOMEM; b47n->nand_chip.priv = b47n; - b47n->mtd.dev.parent = &pdev->dev; - b47n->mtd.priv = &b47n->nand_chip; /* Required */ + mtd = nand_to_mtd(&b47n->nand_chip); + mtd->dev.parent = &pdev->dev; + mtd->priv = &b47n->nand_chip; /* Required */ b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash); if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { @@ -51,7 +53,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev) platform_set_drvdata(pdev, b47n); - err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0); + err = mtd_device_parse_register(mtd, probes, NULL, NULL, 0); if (err) { pr_err("Failed to register MTD device: %d\n", err); return err; @@ -64,7 +66,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev) { struct bcm47xxnflash *nflash = platform_get_drvdata(pdev); - nand_release(&nflash->mtd); + nand_release(nand_to_mtd(&nflash->nand_chip)); return 0; } diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c index e5b2e48658c4..652478035a7d 100644 --- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c +++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c @@ -421,7 +421,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n) (w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0)); /* Scan NAND */ - err = nand_scan(&b47n->mtd, 1); + err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1); if (err) { pr_err("Could not scan NAND flash: %d\n", err); goto exit;