From patchwork Mon Dec 14 17:14:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 7845971 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 D42D79F3CD for ; Mon, 14 Dec 2015 17:14:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 044C8200E5 for ; Mon, 14 Dec 2015 17:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFB5A203AB for ; Mon, 14 Dec 2015 17:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752264AbbLNRO3 (ORCPT ); Mon, 14 Dec 2015 12:14:29 -0500 Received: from down.free-electrons.com ([37.187.137.238]:51899 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751057AbbLNRO2 (ORCPT ); Mon, 14 Dec 2015 12:14:28 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 2EEEC226; Mon, 14 Dec 2015 18:14:26 +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 (AToulouse-657-1-9-66.w83-193.abo.wanadoo.fr [83.193.70.66]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2042A231; Mon, 14 Dec 2015 18:14:12 +0100 (CET) From: Boris Brezillon To: David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Boris Brezillon , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH] mtd: nand: bcm47xxnflash: fix bcm47xxnflash_remove() Date: Mon, 14 Dec 2015 18:14:10 +0100 Message-Id: <1450113250-12036-1-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP bcm47xxnflash_remove() is supposed to unregister the NAND device previously registered in bcm47xxnflash_probe(), but the current implementation just test for the always NULL ->mtd platform data field (and does not call the right function to unregister it). Kill the useless ->mtd field in struct bcma_nflash, and release the real NAND device in bcm47xxnflash_remove(). Signed-off-by: Boris Brezillon Fixes: a5401370c520 ("mtd: prepare place for BCMA NAND flash driver(s)") Cc: Rafa? Mi?ecki --- drivers/mtd/nand/bcm47xxnflash/main.c | 7 ++++--- include/linux/bcma/bcma_driver_chipcommon.h | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c index 9ba0c0f..4a07e56 100644 --- a/drivers/mtd/nand/bcm47xxnflash/main.c +++ b/drivers/mtd/nand/bcm47xxnflash/main.c @@ -55,15 +55,16 @@ static int bcm47xxnflash_probe(struct platform_device *pdev) return err; } + platform_set_drvdata(pdev, b47n); + return 0; } static int bcm47xxnflash_remove(struct platform_device *pdev) { - struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev); + struct bcm47xxnflash *b47n = platform_get_drvdata(pdev); - if (nflash->mtd) - mtd_device_unregister(nflash->mtd); + nand_release(nand_to_mtd(&b47n->nand_chip)); return 0; } diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index cf03843..3015432 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h @@ -592,13 +592,9 @@ struct bcma_sflash { #endif #ifdef CONFIG_BCMA_NFLASH -struct mtd_info; - struct bcma_nflash { bool present; bool boot; /* This is the flash the SoC boots from */ - - struct mtd_info *mtd; }; #endif