public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: bcm47xxnflash: fix bcm47xxnflash_remove()
@ 2015-12-14 17:14 Boris Brezillon
  2015-12-14 17:30 ` Brian Norris
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2015-12-14 17:14 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, linux-mtd
  Cc: linux-wireless, Boris Brezillon, Rafał Miłecki

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 <boris.brezillon@free-electrons.com>
Fixes: a5401370c520 ("mtd: prepare place for BCMA NAND flash driver(s)")
Cc: Rafał Miłecki <zajec5@gmail.com>
---
 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
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-14 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 17:14 [PATCH] mtd: nand: bcm47xxnflash: fix bcm47xxnflash_remove() Boris Brezillon
2015-12-14 17:30 ` Brian Norris
2015-12-14 17:52   ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox