All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/62] mtd: rawnand: Get rid of nand_release()
@ 2020-05-10 12:11 Miquel Raynal
  2020-05-10 12:11 ` [PATCH 01/62] mtd: rawnand: ams-delta: Stop using nand_release() Miquel Raynal
                   ` (62 more replies)
  0 siblings, 63 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Maxim Levitsky, Jonathan Corbet, Kamal Dasu, Stefan Agner,
	Paul Cercueil, Masahiro Yamada, Boris Brezillon, Harvey Hunt,
	Miquel Raynal, Han Xu, Xiaolei Li, Brian Norris, Piotr Sroka

Hello,

The main goal of this big cleanup series is to get rid of
nand_release(). I am always confused when it comes to use either
nand_cleanup() or nand_release() and I need to check the code in the
core, which is a sign of the API being badly designed.

Historically, there was a "nand_release()" helper only, doing the MTD
device unregistration and cleaning/freeing all objects belonging to
the NAND core. Later (v4.9), nand_cleanup() was been added to take
care of all the NAND cleanup, and was called directly by
nand_release(). This new helper was very useful to cleanup all the
NAND core objects in one go on _probe() error (after a successful
nand_scan()).

Unfortunately, because of the lack of symmetry in the API, a lot of
people also used nand_release wrongly in the _probe() error path.

So now, instead of:

        nand_release(chip);

I would like people to use:

        ret = mtd_device_unregister(mtd);
	WARN_ON(ret);
	nand_cleanup(chip);

Note: as it is currently not possible to handle properly an error on
mtd_device_unregister(), WARN_ON() will at least inform the user.

All of you receiving this cover letter will at least receive one patch
applying this change to the driver you are maintaining.

Thanks,
Miquèl


Miquel Raynal (62):
  mtd: rawnand: ams-delta: Stop using nand_release()
  mtd: rawnand: au1550nd: Stop using nand_release()
  mtd: rawnand: bcm47xx: Stop using nand_release()
  mtd: rawnand: brcmnand: Stop using nand_release()
  mtd: rawnand: cadence: Stop using nand_release()
  mtd: rawnand: cafe: Stop using nand_release()
  mtd: rawnand: cmx270: Stop using nand_release()
  mtd: rawnand: cs553x: Stop using nand_release()
  mtd: rawnand: davinci: Stop using nand_release()
  mtd: rawnand: denali: Delete items from the list in the _remove() path
  mtd: rawnand: denali: Stop using nand_release()
  mtd: rawnand: diskonchip: Fix the probe error path
  mtd: rawnand: diskonchip: Stop using nand_release()
  mtd: rawnand: fsl_elbc: Stop using nand_release()
  mtd: rawnand: fsl_ifc: Stop using nand_release()
  mtd: rawnand: fsl_upm: Stop using nand_release()
  mtd: rawnand: fsmc: Stop using nand_release()
  mtd: rawnand: gpio: Stop using nand_release()
  mtd: rawnand: gpmi: Stop using nand_release()
  mtd: rawnand: hisi504: Stop using nand_release()
  mtd: rawnand: ingenic: Fix the probe error path
  mtd: rawnand: ingenic: Stop using nand_release()
  mtd: rawnand: lpc32xx_mlc: Stop using nand_release()
  mtd: rawnand: lpc32xx_slc: Stop using nand_release()
  mtd: rawnand: marvell: Stop using nand_release()
  mtd: rawnand: mpc5121: Stop using nand_release()
  mtd: rawnand: mtk: Fix the probe error path
  mtd: rawnand: mtk: Stop using nand_release()
  mtd: rawnand: mxc: Stop using nand_release()
  mtd: rawnand: mxic: Stop using nand_release()
  mtd: rawnand: ndfc: Stop using nand_release()
  mtd: rawnand: omap2: Stop using nand_release()
  mtd: rawnand: orion: Fix the probe error path
  mtd: rawnand: orion: Stop using nand_release()
  mtd: rawnand: oxnas: Keep track of registered devices
  mtd: rawnand: oxnas: Fix the probe error path
  mtd: rawnand: oxnas: Unregister all devices on error
  mtd: rawnand: oxnas: Release all devices in the _remove() path
  mtd: rawnand: oxnas: Stop using nand_release()
  mtd: rawnand: pasemi: Fix the probe error path
  mtd: rawnand: pasemi: Stop using nand_release()
  mtd: rawnand: plat_nand: Fix the probe error path
  mtd: rawnand: plat_nand: Stop using nand_release()
  mtd: rawnand: qcom: Stop using nand_release()
  mtd: rawnand: r852: Stop using nand_release()
  mtd: rawnand: s3c2410: Stop using nand_release()
  mtd: rawnand: sh_flctl: Stop using nand_release()
  mtd: rawnand: sharpsl: Fix the probe error path
  mtd: rawnand: sharpsl: Stop using nand_release()
  mtd: ranwnand: socrates: Fix the probe error path
  mtd: rawnand: socrates: Stop using nand_release()
  mtd: rawnand: stm32_fmc2: Stop using nand_release()
  mtd: rawnand: sunxi: Fix the probe error path
  mtd: rawnand: sunxi: Stop using nand_release()
  mtd: rawnand: tango: Stop using nand_release()
  mtd: rawnand: tmio: Fix the probe error path
  mtd: rawnand: tmio: Stop using nand_release()
  mtd: rawnand: txx9ndfmc: Stop using nand_release()
  mtd: rawnand: vf610: Stop using nand_release()
  mtd: rawnand: xway: Fix the probe error path
  mtd: rawnand: xway: Stop using nand_release()
  mtd: rawnand: Stop using nand_release()

 Documentation/driver-api/mtdnand.rst          |  6 ++--
 drivers/mtd/nand/raw/ams-delta.c              |  5 ++-
 drivers/mtd/nand/raw/au1550nd.c               |  5 ++-
 drivers/mtd/nand/raw/bcm47xxnflash/main.c     |  6 +++-
 drivers/mtd/nand/raw/brcmnand/brcmnand.c      | 10 ++++--
 .../mtd/nand/raw/cadence-nand-controller.c    |  7 +++-
 drivers/mtd/nand/raw/cafe_nand.c              |  5 ++-
 drivers/mtd/nand/raw/cmx270_nand.c            |  6 +++-
 drivers/mtd/nand/raw/cs553x_nand.c            |  6 ++--
 drivers/mtd/nand/raw/davinci_nand.c           |  6 +++-
 drivers/mtd/nand/raw/denali.c                 | 13 ++++++--
 drivers/mtd/nand/raw/diskonchip.c             | 12 +++----
 drivers/mtd/nand/raw/fsl_elbc_nand.c          |  7 +++-
 drivers/mtd/nand/raw/fsl_ifc_nand.c           |  7 +++-
 drivers/mtd/nand/raw/fsl_upm.c                |  9 +++--
 drivers/mtd/nand/raw/fsmc_nand.c              |  7 +++-
 drivers/mtd/nand/raw/gpio.c                   |  6 +++-
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c    |  6 +++-
 drivers/mtd/nand/raw/hisi504_nand.c           |  6 +++-
 .../mtd/nand/raw/ingenic/ingenic_nand_drv.c   | 17 ++++++----
 drivers/mtd/nand/raw/lpc32xx_mlc.c            |  7 +++-
 drivers/mtd/nand/raw/lpc32xx_slc.c            |  6 +++-
 drivers/mtd/nand/raw/marvell_nand.c           |  7 +++-
 drivers/mtd/nand/raw/mpc5121_nfc.c            |  5 ++-
 drivers/mtd/nand/raw/mtk_nand.c               | 17 ++++++----
 drivers/mtd/nand/raw/mxc_nand.c               |  6 +++-
 drivers/mtd/nand/raw/mxic_nand.c              |  7 +++-
 drivers/mtd/nand/raw/nand_base.c              | 12 -------
 drivers/mtd/nand/raw/ndfc.c                   |  8 +++--
 drivers/mtd/nand/raw/omap2.c                  |  8 +++--
 drivers/mtd/nand/raw/orion_nand.c             |  8 +++--
 drivers/mtd/nand/raw/oxnas_nand.c             | 33 +++++++++++++------
 drivers/mtd/nand/raw/pasemi_nand.c            |  9 +++--
 drivers/mtd/nand/raw/plat_nand.c              |  8 +++--
 drivers/mtd/nand/raw/qcom_nandc.c             | 11 +++++--
 drivers/mtd/nand/raw/r852.c                   |  6 ++--
 drivers/mtd/nand/raw/s3c2410.c                |  3 +-
 drivers/mtd/nand/raw/sh_flctl.c               |  6 +++-
 drivers/mtd/nand/raw/sharpsl.c                | 14 +++++---
 drivers/mtd/nand/raw/socrates_nand.c          |  8 +++--
 drivers/mtd/nand/raw/stm32_fmc2_nand.c        |  6 +++-
 drivers/mtd/nand/raw/sunxi_nand.c             | 11 +++++--
 drivers/mtd/nand/raw/tango_nand.c             | 11 +++++--
 drivers/mtd/nand/raw/tmio_nand.c              |  8 +++--
 drivers/mtd/nand/raw/txx9ndfmc.c              |  6 ++--
 drivers/mtd/nand/raw/vf610_nfc.c              |  6 +++-
 drivers/mtd/nand/raw/xway_nand.c              |  8 +++--
 include/linux/mtd/bbm.h                       |  2 +-
 include/linux/mtd/rawnand.h                   |  2 --
 49 files changed, 290 insertions(+), 111 deletions(-)

-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 01/62] mtd: rawnand: ams-delta: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                   ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/ams-delta.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c
index d66dab25df20..3711e7a0436c 100644
--- a/drivers/mtd/nand/raw/ams-delta.c
+++ b/drivers/mtd/nand/raw/ams-delta.c
@@ -387,12 +387,15 @@ static int gpio_nand_remove(struct platform_device *pdev)
 {
 	struct gpio_nand *priv = platform_get_drvdata(pdev);
 	struct mtd_info *mtd = nand_to_mtd(&priv->nand_chip);
+	int ret;
 
 	/* Apply write protection */
 	gpiod_set_value(priv->gpiod_nwp, 1);
 
 	/* Unregister device */
-	nand_release(mtd_to_nand(mtd));
+	ret = mtd_device_unregister(mtd);
+	WARN_ON(ret);
+	nand_cleanup(mtd_to_nand(mtd));
 
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 02/62] mtd: rawnand: au1550nd: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
  2020-05-10 12:11 ` [PATCH 01/62] mtd: rawnand: ams-delta: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 03/62] mtd: rawnand: bcm47xx: " Miquel Raynal
                   ` (60 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/au1550nd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/au1550nd.c b/drivers/mtd/nand/raw/au1550nd.c
index 75eb3e97fae3..d6a21dcdbf3d 100644
--- a/drivers/mtd/nand/raw/au1550nd.c
+++ b/drivers/mtd/nand/raw/au1550nd.c
@@ -466,8 +466,11 @@ static int au1550nd_remove(struct platform_device *pdev)
 {
 	struct au1550nd_ctx *ctx = platform_get_drvdata(pdev);
 	struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	struct nand_chip *chip = &ctx->chip;
 
-	nand_release(&ctx->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	iounmap(ctx->base);
 	release_mem_region(r->start, 0x1000);
 	kfree(ctx);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 03/62] mtd: rawnand: bcm47xx: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
  2020-05-10 12:11 ` [PATCH 01/62] mtd: rawnand: ams-delta: Stop using nand_release() Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 04/62] mtd: rawnand: brcmnand: " Miquel Raynal
                   ` (59 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/bcm47xxnflash/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/bcm47xxnflash/main.c b/drivers/mtd/nand/raw/bcm47xxnflash/main.c
index 8dae97c1dbe7..dcc70d9dc6e5 100644
--- a/drivers/mtd/nand/raw/bcm47xxnflash/main.c
+++ b/drivers/mtd/nand/raw/bcm47xxnflash/main.c
@@ -60,8 +60,12 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
 static int bcm47xxnflash_remove(struct platform_device *pdev)
 {
 	struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &nflash->nand_chip;
+	int ret;
 
-	nand_release(&nflash->nand_chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 04/62] mtd: rawnand: brcmnand: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (2 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 03/62] mtd: rawnand: bcm47xx: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 05/62] mtd: rawnand: cadence: " Miquel Raynal
                   ` (58 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Brian Norris, Boris Brezillon, Kamal Dasu, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Kamal Dasu <kdasu.kdev@gmail.com>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 949f50e5b817..3d43b37c0b07 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -3046,9 +3046,15 @@ int brcmnand_remove(struct platform_device *pdev)
 {
 	struct brcmnand_controller *ctrl = dev_get_drvdata(&pdev->dev);
 	struct brcmnand_host *host;
+	struct nand_chip *chip;
+	int ret;
 
-	list_for_each_entry(host, &ctrl->host_list, node)
-		nand_release(&host->chip);
+	list_for_each_entry(host, &ctrl->host_list, node) {
+		chip = &host->chip;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
+	}
 
 	clk_disable_unprepare(ctrl->clk);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 05/62] mtd: rawnand: cadence: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (3 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 04/62] mtd: rawnand: brcmnand: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 06/62] mtd: rawnand: cafe: " Miquel Raynal
                   ` (57 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Piotr Sroka, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Piotr Sroka <piotrs@cadence.com>
---
 drivers/mtd/nand/raw/cadence-nand-controller.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/cadence-nand-controller.c b/drivers/mtd/nand/raw/cadence-nand-controller.c
index 61aff01b18e2..7840f6dc8f73 100644
--- a/drivers/mtd/nand/raw/cadence-nand-controller.c
+++ b/drivers/mtd/nand/raw/cadence-nand-controller.c
@@ -2780,9 +2780,14 @@ static int cadence_nand_chip_init(struct cdns_nand_ctrl *cdns_ctrl,
 static void cadence_nand_chips_cleanup(struct cdns_nand_ctrl *cdns_ctrl)
 {
 	struct cdns_nand_chip *entry, *temp;
+	struct nand_chip *chip;
+	int ret;
 
 	list_for_each_entry_safe(entry, temp, &cdns_ctrl->chips, node) {
-		nand_release(&entry->chip);
+		chip = &entry->chip;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
 		list_del(&entry->node);
 	}
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 06/62] mtd: rawnand: cafe: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (4 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 05/62] mtd: rawnand: cadence: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 07/62] mtd: rawnand: cmx270: " Miquel Raynal
                   ` (56 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/cafe_nand.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c
index 2d1c22dc88c1..f14ade57219d 100644
--- a/drivers/mtd/nand/raw/cafe_nand.c
+++ b/drivers/mtd/nand/raw/cafe_nand.c
@@ -814,11 +814,14 @@ static void cafe_nand_remove(struct pci_dev *pdev)
 	struct mtd_info *mtd = pci_get_drvdata(pdev);
 	struct nand_chip *chip = mtd_to_nand(mtd);
 	struct cafe_priv *cafe = nand_get_controller_data(chip);
+	int ret;
 
 	/* Disable NAND IRQ in global IRQ mask register */
 	cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
 	free_irq(pdev->irq, mtd);
-	nand_release(chip);
+	ret = mtd_device_unregister(mtd);
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	free_rs(cafe->rs);
 	pci_iounmap(pdev, cafe->mmio);
 	dma_free_coherent(&cafe->pdev->dev, 2112, cafe->dmabuf, cafe->dmaaddr);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 07/62] mtd: rawnand: cmx270: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (5 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 06/62] mtd: rawnand: cafe: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 08/62] mtd: rawnand: cs553x: " Miquel Raynal
                   ` (55 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/cmx270_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/cmx270_nand.c b/drivers/mtd/nand/raw/cmx270_nand.c
index 045b6175ae79..42c4cc030be3 100644
--- a/drivers/mtd/nand/raw/cmx270_nand.c
+++ b/drivers/mtd/nand/raw/cmx270_nand.c
@@ -219,8 +219,12 @@ module_init(cmx270_init);
  */
 static void __exit cmx270_cleanup(void)
 {
+	int ret;
+
 	/* Release resources, unregister device */
-	nand_release(mtd_to_nand(cmx270_nand_mtd));
+	ret = mtd_device_unregister(cmx270_nand_mtd);
+	WARN_ON(ret);
+	nand_cleanup(mtd_to_nand(cmx270_nand_mtd));
 
 	gpio_free(GPIO_NAND_RB);
 	gpio_free(GPIO_NAND_CS);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 08/62] mtd: rawnand: cs553x: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (6 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 07/62] mtd: rawnand: cmx270: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 09/62] mtd: rawnand: davinci: " Miquel Raynal
                   ` (54 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/cs553x_nand.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/cs553x_nand.c b/drivers/mtd/nand/raw/cs553x_nand.c
index e2322cee3229..98f13e4c634c 100644
--- a/drivers/mtd/nand/raw/cs553x_nand.c
+++ b/drivers/mtd/nand/raw/cs553x_nand.c
@@ -315,6 +315,7 @@ static void __exit cs553x_cleanup(void)
 		struct mtd_info *mtd = cs553x_mtd[i];
 		struct nand_chip *this;
 		void __iomem *mmio_base;
+		int ret;
 
 		if (!mtd)
 			continue;
@@ -323,8 +324,9 @@ static void __exit cs553x_cleanup(void)
 		mmio_base = this->legacy.IO_ADDR_R;
 
 		/* Release resources, unregister device */
-		nand_release(this);
-		kfree(mtd->name);
+		ret = mtd_device_unregister(mtd);
+		WARN_ON(ret);
+		nand_cleanup(this);
 		cs553x_mtd[i] = NULL;
 
 		/* unmap physical address */
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 09/62] mtd: rawnand: davinci: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (7 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 08/62] mtd: rawnand: cs553x: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 10/62] mtd: rawnand: denali: Delete items from the list in the _remove() path Miquel Raynal
                   ` (53 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/davinci_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 25c185bea50c..322f9009a01b 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -817,13 +817,17 @@ static int nand_davinci_probe(struct platform_device *pdev)
 static int nand_davinci_remove(struct platform_device *pdev)
 {
 	struct davinci_nand_info *info = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &info->chip;
+	int ret;
 
 	spin_lock_irq(&davinci_nand_lock);
 	if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
 		ecc4_busy = false;
 	spin_unlock_irq(&davinci_nand_lock);
 
-	nand_release(&info->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 10/62] mtd: rawnand: denali: Delete items from the list in the _remove() path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (8 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 09/62] mtd: rawnand: davinci: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-11  2:47   ` Masahiro Yamada
  2020-05-10 12:11 ` [PATCH 11/62] mtd: rawnand: denali: Stop using nand_release() Miquel Raynal
                   ` (52 subsequent siblings)
  62 siblings, 1 reply; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Masahiro Yamada, Boris Brezillon, Miquel Raynal

Denali driver keeps track of devices with a list. Delete items of this
list as long as they are not in use anymore.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
---
 drivers/mtd/nand/raw/denali.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
index d40f9c8e2241..227474ca7743 100644
--- a/drivers/mtd/nand/raw/denali.c
+++ b/drivers/mtd/nand/raw/denali.c
@@ -1336,10 +1336,12 @@ EXPORT_SYMBOL(denali_init);
 
 void denali_remove(struct denali_controller *denali)
 {
-	struct denali_chip *dchip;
+	struct denali_chip *dchip, *tmp;
 
-	list_for_each_entry(dchip, &denali->chips, node)
+	list_for_each_entry_safe(dchip, tmp, &denali->chips, node) {
 		nand_release(&dchip->chip);
+		list_del(&dchip->node);
+	}
 
 	denali_disable_irq(denali);
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 11/62] mtd: rawnand: denali: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (9 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 10/62] mtd: rawnand: denali: Delete items from the list in the _remove() path Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-11  2:49   ` Masahiro Yamada
  2020-05-10 12:11   ` Miquel Raynal
                   ` (51 subsequent siblings)
  62 siblings, 1 reply; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Masahiro Yamada, Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
---
 drivers/mtd/nand/raw/denali.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
index 227474ca7743..5455746251d1 100644
--- a/drivers/mtd/nand/raw/denali.c
+++ b/drivers/mtd/nand/raw/denali.c
@@ -1337,9 +1337,14 @@ EXPORT_SYMBOL(denali_init);
 void denali_remove(struct denali_controller *denali)
 {
 	struct denali_chip *dchip, *tmp;
+	struct nand_chip *chip;
+	int ret;
 
 	list_for_each_entry_safe(dchip, tmp, &denali->chips, node) {
-		nand_release(&dchip->chip);
+		chip = &dchip->chip;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
 		list_del(&dchip->node);
 	}
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 12/62] mtd: rawnand: diskonchip: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:11   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

Not sure nand_cleanup() is the right function to call here but in any
case it is not nand_release(). Indeed, even a comment says that
calling nand_release() is a bit of a hack as there is no MTD device to
unregister. So switch to nand_cleanup() for now and drop this
comment.

There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if it did not intruce
any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/diskonchip.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/diskonchip.c b/drivers/mtd/nand/raw/diskonchip.c
index c2a391ad2c35..baabc6633557 100644
--- a/drivers/mtd/nand/raw/diskonchip.c
+++ b/drivers/mtd/nand/raw/diskonchip.c
@@ -1609,13 +1609,10 @@ static int __init doc_probe(unsigned long physadr)
 		numchips = doc2001_init(mtd);
 
 	if ((ret = nand_scan(nand, numchips)) || (ret = doc->late_init(mtd))) {
-		/* DBB note: i believe nand_release is necessary here, as
+		/* DBB note: i believe nand_cleanup is necessary here, as
 		   buffers may have been allocated in nand_base.  Check with
 		   Thomas. FIX ME! */
-		/* nand_release will call mtd_device_unregister, but we
-		   haven't yet added it.  This is handled without incident by
-		   mtd_device_unregister, as far as I can tell. */
-		nand_release(nand);
+		nand_cleanup(nand);
 		goto fail;
 	}
 
-- 
2.20.1


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

* [PATCH 12/62] mtd: rawnand: diskonchip: Fix the probe error path
@ 2020-05-10 12:11   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

Not sure nand_cleanup() is the right function to call here but in any
case it is not nand_release(). Indeed, even a comment says that
calling nand_release() is a bit of a hack as there is no MTD device to
unregister. So switch to nand_cleanup() for now and drop this
comment.

There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if it did not intruce
any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/diskonchip.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/diskonchip.c b/drivers/mtd/nand/raw/diskonchip.c
index c2a391ad2c35..baabc6633557 100644
--- a/drivers/mtd/nand/raw/diskonchip.c
+++ b/drivers/mtd/nand/raw/diskonchip.c
@@ -1609,13 +1609,10 @@ static int __init doc_probe(unsigned long physadr)
 		numchips = doc2001_init(mtd);
 
 	if ((ret = nand_scan(nand, numchips)) || (ret = doc->late_init(mtd))) {
-		/* DBB note: i believe nand_release is necessary here, as
+		/* DBB note: i believe nand_cleanup is necessary here, as
 		   buffers may have been allocated in nand_base.  Check with
 		   Thomas. FIX ME! */
-		/* nand_release will call mtd_device_unregister, but we
-		   haven't yet added it.  This is handled without incident by
-		   mtd_device_unregister, as far as I can tell. */
-		nand_release(nand);
+		nand_cleanup(nand);
 		goto fail;
 	}
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 13/62] mtd: rawnand: diskonchip: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (11 preceding siblings ...)
  2020-05-10 12:11   ` Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 14/62] mtd: rawnand: fsl_elbc: " Miquel Raynal
                   ` (49 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/diskonchip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/diskonchip.c b/drivers/mtd/nand/raw/diskonchip.c
index baabc6633557..8d203b2e2aaa 100644
--- a/drivers/mtd/nand/raw/diskonchip.c
+++ b/drivers/mtd/nand/raw/diskonchip.c
@@ -1641,13 +1641,16 @@ static void release_nanddoc(void)
 	struct mtd_info *mtd, *nextmtd;
 	struct nand_chip *nand;
 	struct doc_priv *doc;
+	int ret;
 
 	for (mtd = doclist; mtd; mtd = nextmtd) {
 		nand = mtd_to_nand(mtd);
 		doc = nand_get_controller_data(nand);
 
 		nextmtd = doc->nextdoc;
-		nand_release(nand);
+		ret = mtd_device_unregister(mtd);
+		WARN_ON(ret);
+		nand_cleanup(nand);
 		iounmap(doc->virtadr);
 		release_mem_region(doc->physadr, DOC_IOREMAP_LEN);
 		free_rs(doc->rs_decoder);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 14/62] mtd: rawnand: fsl_elbc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (12 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 13/62] mtd: rawnand: diskonchip: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 15/62] mtd: rawnand: fsl_ifc: " Miquel Raynal
                   ` (48 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/fsl_elbc_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
index e1dc675b12bb..088692b2e27a 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
@@ -956,8 +956,13 @@ static int fsl_elbc_nand_remove(struct platform_device *pdev)
 {
 	struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = fsl_lbc_ctrl_dev->nand;
 	struct fsl_elbc_mtd *priv = dev_get_drvdata(&pdev->dev);
+	struct nand_chip *chip = &priv->chip;
+	int ret;
+
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
-	nand_release(&priv->chip);
 	fsl_elbc_chip_remove(priv);
 
 	mutex_lock(&fsl_elbc_nand_mutex);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 15/62] mtd: rawnand: fsl_ifc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (13 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 14/62] mtd: rawnand: fsl_elbc: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 16/62] mtd: rawnand: fsl_upm: " Miquel Raynal
                   ` (47 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/fsl_ifc_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c
index 2af09edf405b..00ae7a910b03 100644
--- a/drivers/mtd/nand/raw/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c
@@ -1093,8 +1093,13 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
 static int fsl_ifc_nand_remove(struct platform_device *dev)
 {
 	struct fsl_ifc_mtd *priv = dev_get_drvdata(&dev->dev);
+	struct nand_chip *chip = &priv->chip;
+	int ret;
+
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
-	nand_release(&priv->chip);
 	fsl_ifc_chip_remove(priv);
 
 	mutex_lock(&fsl_ifc_nand_mutex);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 16/62] mtd: rawnand: fsl_upm: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (14 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 15/62] mtd: rawnand: fsl_ifc: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 17/62] mtd: rawnand: fsmc: " Miquel Raynal
                   ` (46 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/fsl_upm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/fsl_upm.c b/drivers/mtd/nand/raw/fsl_upm.c
index f31fae3a4c68..627deb26db51 100644
--- a/drivers/mtd/nand/raw/fsl_upm.c
+++ b/drivers/mtd/nand/raw/fsl_upm.c
@@ -317,10 +317,13 @@ static int fun_probe(struct platform_device *ofdev)
 static int fun_remove(struct platform_device *ofdev)
 {
 	struct fsl_upm_nand *fun = dev_get_drvdata(&ofdev->dev);
-	struct mtd_info *mtd = nand_to_mtd(&fun->chip);
-	int i;
+	struct nand_chip *chip = &fun->chip;
+	struct mtd_info *mtd = nand_to_mtd(chip);
+	int ret, i;
 
-	nand_release(&fun->chip);
+	ret = mtd_device_unregister(mtd);
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	kfree(mtd->name);
 
 	for (i = 0; i < fun->mchip_count; i++) {
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 17/62] mtd: rawnand: fsmc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (15 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 16/62] mtd: rawnand: fsl_upm: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 18/62] mtd: rawnand: gpio: " Miquel Raynal
                   ` (45 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/fsmc_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index 735c2216149f..d178ab2e7366 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -1135,7 +1135,12 @@ static int fsmc_nand_remove(struct platform_device *pdev)
 	struct fsmc_nand_data *host = platform_get_drvdata(pdev);
 
 	if (host) {
-		nand_release(&host->nand);
+		struct nand_chip *chip = &host->nand;
+		int ret;
+
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
 		fsmc_nand_disable(host);
 
 		if (host->mode == USE_DMA_ACCESS) {
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 18/62] mtd: rawnand: gpio: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (16 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 17/62] mtd: rawnand: fsmc: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 19/62] mtd: rawnand: gpmi: " Miquel Raynal
                   ` (44 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/gpio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/gpio.c b/drivers/mtd/nand/raw/gpio.c
index f6b12354024f..938077e5c6a9 100644
--- a/drivers/mtd/nand/raw/gpio.c
+++ b/drivers/mtd/nand/raw/gpio.c
@@ -190,8 +190,12 @@ gpio_nand_get_io_sync(struct platform_device *pdev)
 static int gpio_nand_remove(struct platform_device *pdev)
 {
 	struct gpiomtd *gpiomtd = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &gpiomtd->nand_chip;
+	int ret;
 
-	nand_release(&gpiomtd->nand_chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	/* Enable write protection and disable the chip */
 	if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp))
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 19/62] mtd: rawnand: gpmi: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (17 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 18/62] mtd: rawnand: gpio: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 20/62] mtd: rawnand: hisi504: " Miquel Raynal
                   ` (43 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Han Xu, Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Han Xu <han.xu@nxp.com>
---
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index 97b460d8d0c1..0c2763523caf 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -2542,11 +2542,15 @@ static int gpmi_nand_probe(struct platform_device *pdev)
 static int gpmi_nand_remove(struct platform_device *pdev)
 {
 	struct gpmi_nand_data *this = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &this->nand;
+	int ret;
 
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
-	nand_release(&this->nand);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	gpmi_free_dma_buffer(this);
 	release_resources(this);
 	return 0;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 20/62] mtd: rawnand: hisi504: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (18 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 19/62] mtd: rawnand: gpmi: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11   ` Miquel Raynal
                   ` (42 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/hisi504_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/hisi504_nand.c b/drivers/mtd/nand/raw/hisi504_nand.c
index 0b48be54ba6f..b84238e2268a 100644
--- a/drivers/mtd/nand/raw/hisi504_nand.c
+++ b/drivers/mtd/nand/raw/hisi504_nand.c
@@ -806,8 +806,12 @@ static int hisi_nfc_probe(struct platform_device *pdev)
 static int hisi_nfc_remove(struct platform_device *pdev)
 {
 	struct hinfc_host *host = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &host->chip;
+	int ret;
 
-	nand_release(&host->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 21/62] mtd: rawnand: ingenic: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:11   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable, Paul Cercueil, Harvey Hunt

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. Hence, pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug makes sense.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Harvey Hunt <harveyhuntnexus@gmail.com>
---
 drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
index 935c4902ada7..6e90c2d5cb3a 100644
--- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
+++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
@@ -376,7 +376,7 @@ static int ingenic_nand_init_chip(struct platform_device *pdev,
 
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret) {
-		nand_release(chip);
+		nand_cleanup(chip);
 		return ret;
 	}
 
-- 
2.20.1


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

* [PATCH 21/62] mtd: rawnand: ingenic: Fix the probe error path
@ 2020-05-10 12:11   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Paul Cercueil, Harvey Hunt, Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. Hence, pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug makes sense.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Harvey Hunt <harveyhuntnexus@gmail.com>
---
 drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
index 935c4902ada7..6e90c2d5cb3a 100644
--- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
+++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
@@ -376,7 +376,7 @@ static int ingenic_nand_init_chip(struct platform_device *pdev,
 
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret) {
-		nand_release(chip);
+		nand_cleanup(chip);
 		return ret;
 	}
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 22/62] mtd: rawnand: ingenic: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (20 preceding siblings ...)
  2020-05-10 12:11   ` Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 23/62] mtd: rawnand: lpc32xx_mlc: " Miquel Raynal
                   ` (40 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Paul Cercueil, Boris Brezillon, Harvey Hunt, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Harvey Hunt <harveyhuntnexus@gmail.com>
---
 drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
index 6e90c2d5cb3a..88e4f90caeb8 100644
--- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
+++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
@@ -387,13 +387,18 @@ static int ingenic_nand_init_chip(struct platform_device *pdev,
 
 static void ingenic_nand_cleanup_chips(struct ingenic_nfc *nfc)
 {
-	struct ingenic_nand *chip;
+	struct ingenic_nand *ingenic_chip;
+	struct nand_chip *chip;
+	int ret;
 
 	while (!list_empty(&nfc->chips)) {
-		chip = list_first_entry(&nfc->chips,
-					struct ingenic_nand, chip_list);
-		nand_release(&chip->chip);
-		list_del(&chip->chip_list);
+		ingenic_chip = list_first_entry(&nfc->chips,
+						struct ingenic_nand, chip_list);
+		chip = &ingenic_chip->chip;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
+		list_del(&ingenic_chip->chip_list);
 	}
 }
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 23/62] mtd: rawnand: lpc32xx_mlc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (21 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 22/62] mtd: rawnand: ingenic: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 24/62] mtd: rawnand: lpc32xx_slc: " Miquel Raynal
                   ` (39 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/lpc32xx_mlc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/lpc32xx_mlc.c b/drivers/mtd/nand/raw/lpc32xx_mlc.c
index 241b58b83240..7521038af2ef 100644
--- a/drivers/mtd/nand/raw/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_mlc.c
@@ -826,8 +826,13 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 static int lpc32xx_nand_remove(struct platform_device *pdev)
 {
 	struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &host->nand_chip;
+	int ret;
+
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
-	nand_release(&host->nand_chip);
 	free_irq(host->irq, host);
 	if (use_dma)
 		dma_release_channel(host->dma_chan);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 24/62] mtd: rawnand: lpc32xx_slc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (22 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 23/62] mtd: rawnand: lpc32xx_mlc: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 25/62] mtd: rawnand: marvell: " Miquel Raynal
                   ` (38 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/lpc32xx_slc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/lpc32xx_slc.c b/drivers/mtd/nand/raw/lpc32xx_slc.c
index 163f976353f8..b151fd000815 100644
--- a/drivers/mtd/nand/raw/lpc32xx_slc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_slc.c
@@ -947,8 +947,12 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
 {
 	uint32_t tmp;
 	struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &host->nand_chip;
+	int ret;
 
-	nand_release(&host->nand_chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	dma_release_channel(host->dma_chan);
 
 	/* Force CE high */
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 25/62] mtd: rawnand: marvell: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (23 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 24/62] mtd: rawnand: lpc32xx_slc: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 26/62] mtd: rawnand: mpc5121: " Miquel Raynal
                   ` (37 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/marvell_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index a79ce4bdd31c..260a0430313e 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -2676,9 +2676,14 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
 static void marvell_nand_chips_cleanup(struct marvell_nfc *nfc)
 {
 	struct marvell_nand_chip *entry, *temp;
+	struct nand_chip *chip;
+	int ret;
 
 	list_for_each_entry_safe(entry, temp, &nfc->chips, node) {
-		nand_release(&entry->chip);
+		chip = &entry->chip;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
 		list_del(&entry->node);
 	}
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 26/62] mtd: rawnand: mpc5121: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (24 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 25/62] mtd: rawnand: marvell: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11   ` Miquel Raynal
                   ` (36 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/mpc5121_nfc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/mpc5121_nfc.c b/drivers/mtd/nand/raw/mpc5121_nfc.c
index a2fcb739e5f8..18ecb096a32d 100644
--- a/drivers/mtd/nand/raw/mpc5121_nfc.c
+++ b/drivers/mtd/nand/raw/mpc5121_nfc.c
@@ -805,8 +805,11 @@ static int mpc5121_nfc_remove(struct platform_device *op)
 {
 	struct device *dev = &op->dev;
 	struct mtd_info *mtd = dev_get_drvdata(dev);
+	int ret;
 
-	nand_release(mtd_to_nand(mtd));
+	ret = mtd_device_unregister(mtd);
+	WARN_ON(ret);
+	nand_cleanup(mtd_to_nand(mtd));
 	mpc5121_nfc_free(dev, mtd);
 
 	return 0;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 27/62] mtd: rawnand: mtk: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:11   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable, Xiaolei Li

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
Cc: Xiaolei Li <xiaolei.li@mediatek.com>
---
 drivers/mtd/nand/raw/mtk_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index e7ec30e784fd..9dad08bed2bb 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -1419,7 +1419,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret) {
 		dev_err(dev, "mtd parse partition error\n");
-		nand_release(nand);
+		nand_cleanup(nand);
 		return ret;
 	}
 
-- 
2.20.1


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

* [PATCH 27/62] mtd: rawnand: mtk: Fix the probe error path
@ 2020-05-10 12:11   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Xiaolei Li, Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
Cc: Xiaolei Li <xiaolei.li@mediatek.com>
---
 drivers/mtd/nand/raw/mtk_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index e7ec30e784fd..9dad08bed2bb 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -1419,7 +1419,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret) {
 		dev_err(dev, "mtd parse partition error\n");
-		nand_release(nand);
+		nand_cleanup(nand);
 		return ret;
 	}
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 28/62] mtd: rawnand: mtk: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (26 preceding siblings ...)
  2020-05-10 12:11   ` Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 29/62] mtd: rawnand: mxc: " Miquel Raynal
                   ` (34 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Xiaolei Li, Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Xiaolei Li <xiaolei.li@mediatek.com>
---
 drivers/mtd/nand/raw/mtk_nand.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index 9dad08bed2bb..c1a6e31aabb8 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -1578,13 +1578,18 @@ static int mtk_nfc_probe(struct platform_device *pdev)
 static int mtk_nfc_remove(struct platform_device *pdev)
 {
 	struct mtk_nfc *nfc = platform_get_drvdata(pdev);
-	struct mtk_nfc_nand_chip *chip;
+	struct mtk_nfc_nand_chip *mtk_chip;
+	struct nand_chip *chip;
+	int ret;
 
 	while (!list_empty(&nfc->chips)) {
-		chip = list_first_entry(&nfc->chips, struct mtk_nfc_nand_chip,
-					node);
-		nand_release(&chip->nand);
-		list_del(&chip->node);
+		mtk_chip = list_first_entry(&nfc->chips,
+					    struct mtk_nfc_nand_chip, node);
+		chip = &mtk_chip->nand;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
+		list_del(&mtk_chip->node);
 	}
 
 	mtk_ecc_release(nfc->ecc);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 29/62] mtd: rawnand: mxc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (27 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 28/62] mtd: rawnand: mtk: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 30/62] mtd: rawnand: mxic: " Miquel Raynal
                   ` (33 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/mxc_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index 59554c187e01..09dacb83cb5a 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -1919,8 +1919,12 @@ static int mxcnd_probe(struct platform_device *pdev)
 static int mxcnd_remove(struct platform_device *pdev)
 {
 	struct mxc_nand_host *host = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &host->nand;
+	int ret;
 
-	nand_release(&host->nand);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	if (host->clk_act)
 		clk_disable_unprepare(host->clk);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 30/62] mtd: rawnand: mxic: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (28 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 29/62] mtd: rawnand: mxc: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 31/62] mtd: rawnand: ndfc: " Miquel Raynal
                   ` (32 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/mxic_nand.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/mxic_nand.c b/drivers/mtd/nand/raw/mxic_nand.c
index 5a5a5b3b546d..57f36721f4c6 100644
--- a/drivers/mtd/nand/raw/mxic_nand.c
+++ b/drivers/mtd/nand/raw/mxic_nand.c
@@ -556,8 +556,13 @@ static int mxic_nfc_probe(struct platform_device *pdev)
 static int mxic_nfc_remove(struct platform_device *pdev)
 {
 	struct mxic_nand_ctlr *nfc = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &nfc->chip;
+	int ret;
+
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
-	nand_release(&nfc->chip);
 	mxic_nfc_clk_disable(nfc);
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 31/62] mtd: rawnand: ndfc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (29 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 30/62] mtd: rawnand: mxic: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 32/62] mtd: rawnand: omap2: " Miquel Raynal
                   ` (31 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/ndfc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/ndfc.c b/drivers/mtd/nand/raw/ndfc.c
index d324396ab7ff..ed38338c1383 100644
--- a/drivers/mtd/nand/raw/ndfc.c
+++ b/drivers/mtd/nand/raw/ndfc.c
@@ -244,9 +244,13 @@ static int ndfc_probe(struct platform_device *ofdev)
 static int ndfc_remove(struct platform_device *ofdev)
 {
 	struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev);
-	struct mtd_info *mtd = nand_to_mtd(&ndfc->chip);
+	struct nand_chip *chip = &ndfc->chip;
+	struct mtd_info *mtd = nand_to_mtd(chip);
+	int ret;
 
-	nand_release(&ndfc->chip);
+	ret = mtd_device_unregister(mtd);
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	kfree(mtd->name);
 
 	return 0;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 32/62] mtd: rawnand: omap2: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (30 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 31/62] mtd: rawnand: ndfc: " Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11   ` Miquel Raynal
                   ` (30 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/omap2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c
index ad77c112a78a..eb7fcfd9276b 100644
--- a/drivers/mtd/nand/raw/omap2.c
+++ b/drivers/mtd/nand/raw/omap2.c
@@ -2283,14 +2283,18 @@ static int omap_nand_remove(struct platform_device *pdev)
 	struct mtd_info *mtd = platform_get_drvdata(pdev);
 	struct nand_chip *nand_chip = mtd_to_nand(mtd);
 	struct omap_nand_info *info = mtd_to_omap(mtd);
+	int ret;
+
 	if (nand_chip->ecc.priv) {
 		nand_bch_free(nand_chip->ecc.priv);
 		nand_chip->ecc.priv = NULL;
 	}
 	if (info->dma)
 		dma_release_channel(info->dma);
-	nand_release(nand_chip);
-	return 0;
+	ret = mtd_device_unregister(mtd);
+	WARN_ON(ret);
+	nand_cleanup(nand_chip);
+	return ret;
 }
 
 static const struct of_device_id omap_nand_ids[] = {
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 33/62] mtd: rawnand: orion: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:11   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/orion_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/orion_nand.c b/drivers/mtd/nand/raw/orion_nand.c
index d27b39a7223c..a3dcdf25f5f2 100644
--- a/drivers/mtd/nand/raw/orion_nand.c
+++ b/drivers/mtd/nand/raw/orion_nand.c
@@ -180,7 +180,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	mtd->name = "orion_nand";
 	ret = mtd_device_register(mtd, board->parts, board->nr_parts);
 	if (ret) {
-		nand_release(nc);
+		nand_cleanup(nc);
 		goto no_dev;
 	}
 
-- 
2.20.1


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

* [PATCH 33/62] mtd: rawnand: orion: Fix the probe error path
@ 2020-05-10 12:11   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/orion_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/orion_nand.c b/drivers/mtd/nand/raw/orion_nand.c
index d27b39a7223c..a3dcdf25f5f2 100644
--- a/drivers/mtd/nand/raw/orion_nand.c
+++ b/drivers/mtd/nand/raw/orion_nand.c
@@ -180,7 +180,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	mtd->name = "orion_nand";
 	ret = mtd_device_register(mtd, board->parts, board->nr_parts);
 	if (ret) {
-		nand_release(nc);
+		nand_cleanup(nc);
 		goto no_dev;
 	}
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 34/62] mtd: rawnand: orion: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (32 preceding siblings ...)
  2020-05-10 12:11   ` Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 35/62] mtd: rawnand: oxnas: Keep track of registered devices Miquel Raynal
                   ` (28 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/orion_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/orion_nand.c b/drivers/mtd/nand/raw/orion_nand.c
index a3dcdf25f5f2..880b54ca1b41 100644
--- a/drivers/mtd/nand/raw/orion_nand.c
+++ b/drivers/mtd/nand/raw/orion_nand.c
@@ -195,8 +195,12 @@ static int orion_nand_remove(struct platform_device *pdev)
 {
 	struct orion_nand_info *info = platform_get_drvdata(pdev);
 	struct nand_chip *chip = &info->chip;
+	int ret;
 
-	nand_release(chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+
+	nand_cleanup(chip);
 
 	clk_disable_unprepare(info->clk);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 35/62] mtd: rawnand: oxnas: Keep track of registered devices
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (33 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 34/62] mtd: rawnand: orion: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11   ` Miquel Raynal
                   ` (27 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

All initialized and registered devices should be listed somewhere so
that we can unregister/free them in the _remove() path.

This patch is not a fix per-se but is needed to apply three other
fixes coming right after, explaining the Fixes/Cc: stable tags.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index c43cb4d92d3d..bead5ac70160 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -32,6 +32,7 @@ struct oxnas_nand_ctrl {
 	void __iomem *io_base;
 	struct clk *clk;
 	struct nand_chip *chips[OXNAS_NAND_MAX_CHIPS];
+	unsigned int nchips;
 };
 
 static uint8_t oxnas_nand_read_byte(struct nand_chip *chip)
@@ -79,7 +80,6 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 	struct nand_chip *chip;
 	struct mtd_info *mtd;
 	struct resource *res;
-	int nchips = 0;
 	int count = 0;
 	int err = 0;
 
@@ -145,12 +145,12 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 			goto err_release_child;
 		}
 
-		oxnas->chips[nchips] = chip;
-		++nchips;
+		oxnas->chips[oxnas->nchips] = chip;
+		++oxnas->nchips;
 	}
 
 	/* Exit if no chips found */
-	if (!nchips) {
+	if (!oxnas->nchips) {
 		err = -ENODEV;
 		goto err_clk_unprepare;
 	}
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 36/62] mtd: rawnand: oxnas: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:11   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

While at it, be consistent and move the function call in the error
path thanks to a goto statement.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index bead5ac70160..4fadfa118582 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -140,10 +140,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 			goto err_release_child;
 
 		err = mtd_device_register(mtd, NULL, 0);
-		if (err) {
-			nand_release(chip);
-			goto err_release_child;
-		}
+		if (err)
+			goto err_cleanup_nand;
 
 		oxnas->chips[oxnas->nchips] = chip;
 		++oxnas->nchips;
@@ -159,6 +157,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 
 	return 0;
 
+err_cleanup_nand:
+	nand_cleanup(chip);
 err_release_child:
 	of_node_put(nand_np);
 err_clk_unprepare:
-- 
2.20.1


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

* [PATCH 36/62] mtd: rawnand: oxnas: Fix the probe error path
@ 2020-05-10 12:11   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

While at it, be consistent and move the function call in the error
path thanks to a goto statement.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index bead5ac70160..4fadfa118582 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -140,10 +140,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 			goto err_release_child;
 
 		err = mtd_device_register(mtd, NULL, 0);
-		if (err) {
-			nand_release(chip);
-			goto err_release_child;
-		}
+		if (err)
+			goto err_cleanup_nand;
 
 		oxnas->chips[oxnas->nchips] = chip;
 		++oxnas->nchips;
@@ -159,6 +157,8 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 
 	return 0;
 
+err_cleanup_nand:
+	nand_cleanup(chip);
 err_release_child:
 	of_node_put(nand_np);
 err_clk_unprepare:
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 37/62] mtd: rawnand: oxnas: Unregister all devices on error
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (35 preceding siblings ...)
  2020-05-10 12:11   ` Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 38/62] mtd: rawnand: oxnas: Release all devices in the _remove() path Miquel Raynal
                   ` (25 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

On error, the oxnas probe path just frees the device which failed and
aborts the probe, leaving unreleased resources.

Fix this situation by calling mtd_device_unregister()/nand_cleanup()
on these.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index 4fadfa118582..25862d62f994 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -82,6 +82,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 	struct resource *res;
 	int count = 0;
 	int err = 0;
+	int i;
 
 	/* Allocate memory for the device structure (and zero it) */
 	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
@@ -161,6 +162,13 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 	nand_cleanup(chip);
 err_release_child:
 	of_node_put(nand_np);
+
+	for (i = 0; i < oxnas->nchips; i++) {
+		chip = oxnas->chips[i];
+		WARN_ON(mtd_device_unregister(nand_to_mtd(chip)));
+		nand_cleanup(chip);
+	}
+
 err_clk_unprepare:
 	clk_disable_unprepare(oxnas->clk);
 	return err;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 38/62] mtd: rawnand: oxnas: Release all devices in the _remove() path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (36 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 37/62] mtd: rawnand: oxnas: Unregister all devices on error Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 39/62] mtd: rawnand: oxnas: Stop using nand_release() Miquel Raynal
                   ` (24 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

oxnans_nand_remove() should release all MTD devices and clean all NAND
devices, not only the first one registered.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/oxnas_nand.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index 25862d62f994..23c222b6c40e 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -177,9 +177,13 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 static int oxnas_nand_remove(struct platform_device *pdev)
 {
 	struct oxnas_nand_ctrl *oxnas = platform_get_drvdata(pdev);
+	struct nand_chip *chip;
+	int i;
 
-	if (oxnas->chips[0])
-		nand_release(oxnas->chips[0]);
+	for (i = 0; i < oxnas->nchips; i++) {
+		chip = oxnas->chips[i];
+		nand_release(chip);
+	}
 
 	clk_disable_unprepare(oxnas->clk);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 39/62] mtd: rawnand: oxnas: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (37 preceding siblings ...)
  2020-05-10 12:11 ` [PATCH 38/62] mtd: rawnand: oxnas: Release all devices in the _remove() path Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:11   ` Miquel Raynal
                   ` (23 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/oxnas_nand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index 23c222b6c40e..8d0d76ad319d 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -182,7 +182,8 @@ static int oxnas_nand_remove(struct platform_device *pdev)
 
 	for (i = 0; i < oxnas->nchips; i++) {
 		chip = oxnas->chips[i];
-		nand_release(chip);
+		WARN_ON(mtd_device_unregister(nand_to_mtd(chip)));
+		nand_cleanup(chip);
 	}
 
 	clk_disable_unprepare(oxnas->clk);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 40/62] mtd: rawnand: pasemi: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:11   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_cleanup() is supposed to be called on error after a successful
call to nand_scan() to free all NAND resources.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible, hence pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/pasemi_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/pasemi_nand.c b/drivers/mtd/nand/raw/pasemi_nand.c
index 9cfe7395172a..be40b2f32237 100644
--- a/drivers/mtd/nand/raw/pasemi_nand.c
+++ b/drivers/mtd/nand/raw/pasemi_nand.c
@@ -146,7 +146,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
 	if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) {
 		dev_err(dev, "Unable to register MTD device\n");
 		err = -ENODEV;
-		goto out_lpc;
+		goto out_cleanup_nand;
 	}
 
 	dev_info(dev, "PA Semi NAND flash at %pR, control at I/O %x\n", &res,
@@ -154,6 +154,8 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
 
 	return 0;
 
+out_cleanup:
+	nand_cleanup(chip);
  out_lpc:
 	release_region(lpcctl, 4);
  out_ior:
-- 
2.20.1


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

* [PATCH 40/62] mtd: rawnand: pasemi: Fix the probe error path
@ 2020-05-10 12:11   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_cleanup() is supposed to be called on error after a successful
call to nand_scan() to free all NAND resources.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible, hence pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/pasemi_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/pasemi_nand.c b/drivers/mtd/nand/raw/pasemi_nand.c
index 9cfe7395172a..be40b2f32237 100644
--- a/drivers/mtd/nand/raw/pasemi_nand.c
+++ b/drivers/mtd/nand/raw/pasemi_nand.c
@@ -146,7 +146,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
 	if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) {
 		dev_err(dev, "Unable to register MTD device\n");
 		err = -ENODEV;
-		goto out_lpc;
+		goto out_cleanup_nand;
 	}
 
 	dev_info(dev, "PA Semi NAND flash at %pR, control at I/O %x\n", &res,
@@ -154,6 +154,8 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
 
 	return 0;
 
+out_cleanup:
+	nand_cleanup(chip);
  out_lpc:
 	release_region(lpcctl, 4);
  out_ior:
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 41/62] mtd: rawnand: pasemi: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (39 preceding siblings ...)
  2020-05-10 12:11   ` Miquel Raynal
@ 2020-05-10 12:11 ` Miquel Raynal
  2020-05-10 12:12   ` Miquel Raynal
                   ` (21 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:11 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/pasemi_nand.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/pasemi_nand.c b/drivers/mtd/nand/raw/pasemi_nand.c
index be40b2f32237..37570f0c3a36 100644
--- a/drivers/mtd/nand/raw/pasemi_nand.c
+++ b/drivers/mtd/nand/raw/pasemi_nand.c
@@ -169,6 +169,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
 static int pasemi_nand_remove(struct platform_device *ofdev)
 {
 	struct nand_chip *chip;
+	int ret;
 
 	if (!pasemi_nand_mtd)
 		return 0;
@@ -176,7 +177,9 @@ static int pasemi_nand_remove(struct platform_device *ofdev)
 	chip = mtd_to_nand(pasemi_nand_mtd);
 
 	/* Release resources, unregister device */
-	nand_release(chip);
+	ret = mtd_device_unregister(pasemi_nand_mtd);
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	release_region(lpcctl, 4);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 42/62] mtd: rawnand: plat_nand: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:12   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible, hence pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/plat_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/plat_nand.c b/drivers/mtd/nand/raw/plat_nand.c
index dc0f3074ddbf..3a495b233443 100644
--- a/drivers/mtd/nand/raw/plat_nand.c
+++ b/drivers/mtd/nand/raw/plat_nand.c
@@ -92,7 +92,7 @@ static int plat_nand_probe(struct platform_device *pdev)
 	if (!err)
 		return err;
 
-	nand_release(&data->chip);
+	nand_cleanup(&data->chip);
 out:
 	if (pdata->ctrl.remove)
 		pdata->ctrl.remove(pdev);
-- 
2.20.1


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

* [PATCH 42/62] mtd: rawnand: plat_nand: Fix the probe error path
@ 2020-05-10 12:12   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible, hence pointing it as the commit to
fix for backporting purposes, even if this commit is not introducing
any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/plat_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/plat_nand.c b/drivers/mtd/nand/raw/plat_nand.c
index dc0f3074ddbf..3a495b233443 100644
--- a/drivers/mtd/nand/raw/plat_nand.c
+++ b/drivers/mtd/nand/raw/plat_nand.c
@@ -92,7 +92,7 @@ static int plat_nand_probe(struct platform_device *pdev)
 	if (!err)
 		return err;
 
-	nand_release(&data->chip);
+	nand_cleanup(&data->chip);
 out:
 	if (pdata->ctrl.remove)
 		pdata->ctrl.remove(pdev);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 43/62] mtd: rawnand: plat_nand: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (41 preceding siblings ...)
  2020-05-10 12:12   ` Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 44/62] mtd: rawnand: qcom: " Miquel Raynal
                   ` (19 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/plat_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/plat_nand.c b/drivers/mtd/nand/raw/plat_nand.c
index 3a495b233443..556182f26057 100644
--- a/drivers/mtd/nand/raw/plat_nand.c
+++ b/drivers/mtd/nand/raw/plat_nand.c
@@ -106,8 +106,12 @@ static int plat_nand_remove(struct platform_device *pdev)
 {
 	struct plat_nand_data *data = platform_get_drvdata(pdev);
 	struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev);
+	struct nand_chip *chip = &data->chip;
+	int ret;
 
-	nand_release(&data->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	if (pdata->ctrl.remove)
 		pdata->ctrl.remove(pdev);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 44/62] mtd: rawnand: qcom: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (42 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 43/62] mtd: rawnand: plat_nand: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 45/62] mtd: rawnand: r852: " Miquel Raynal
                   ` (18 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/qcom_nandc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index 9ab22c5d4166..f1daf330951b 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -3005,10 +3005,15 @@ static int qcom_nandc_remove(struct platform_device *pdev)
 	struct qcom_nand_controller *nandc = platform_get_drvdata(pdev);
 	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	struct qcom_nand_host *host;
+	struct nand_chip *chip;
+	int ret;
 
-	list_for_each_entry(host, &nandc->host_list, node)
-		nand_release(&host->chip);
-
+	list_for_each_entry(host, &nandc->host_list, node) {
+		chip = &host->chip;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
+	}
 
 	qcom_nandc_unalloc(nandc);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 45/62] mtd: rawnand: r852: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (43 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 44/62] mtd: rawnand: qcom: " Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-11 10:33   ` Sergei Shtylyov
  2020-05-10 12:12 ` [PATCH 46/62] mtd: rawnand: s3c2410: " Miquel Raynal
                   ` (17 subsequent siblings)
  62 siblings, 1 reply; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Maxim Levitsky, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
---
 drivers/mtd/nand/raw/r852.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
index 77774250fb11..f865e3a47b01 100644
--- a/drivers/mtd/nand/raw/r852.c
+++ b/drivers/mtd/nand/raw/r852.c
@@ -651,7 +651,8 @@ static int r852_register_nand_device(struct r852_device *dev)
 	dev->card_registered = 1;
 	return 0;
 error3:
-	nand_release(dev->chip);
+	WARN_ON(mtd_device_unregister(nand_to_mtd(dev->chip)));
+	nand_cleanup(dev->chip);
 error1:
 	/* Force card redetect */
 	dev->card_detected = 0;
@@ -670,7 +671,8 @@ static void r852_unregister_nand_device(struct r852_device *dev)
 		return;
 
 	device_remove_file(&mtd->dev, &dev_attr_media_type);
-	nand_release(dev->chip);
+	WARN_ON(mtd_device_unregister(mtd));
+	nand_cleanup(dev->chip);
 	r852_engine_disable(dev);
 	dev->card_registered = 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 46/62] mtd: rawnand: s3c2410: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (44 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 45/62] mtd: rawnand: r852: " Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 47/62] mtd: rawnand: sh_flctl: " Miquel Raynal
                   ` (16 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/s3c2410.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/s3c2410.c b/drivers/mtd/nand/raw/s3c2410.c
index 0009c1820e21..f86dff311464 100644
--- a/drivers/mtd/nand/raw/s3c2410.c
+++ b/drivers/mtd/nand/raw/s3c2410.c
@@ -779,7 +779,8 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
 
 		for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) {
 			pr_debug("releasing mtd %d (%p)\n", mtdno, ptr);
-			nand_release(&ptr->chip);
+			WARN_ON(mtd_device_unregister(nand_to_mtd(&ptr->chip)));
+			nand_cleanup(&ptr->chip);
 		}
 	}
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 47/62] mtd: rawnand: sh_flctl: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (45 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 46/62] mtd: rawnand: s3c2410: " Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12   ` Miquel Raynal
                   ` (15 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/sh_flctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/sh_flctl.c b/drivers/mtd/nand/raw/sh_flctl.c
index 058e99d0cbcf..a661b8bb2dd5 100644
--- a/drivers/mtd/nand/raw/sh_flctl.c
+++ b/drivers/mtd/nand/raw/sh_flctl.c
@@ -1204,9 +1204,13 @@ static int flctl_probe(struct platform_device *pdev)
 static int flctl_remove(struct platform_device *pdev)
 {
 	struct sh_flctl *flctl = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &flctl->chip;
+	int ret;
 
 	flctl_release_dma(flctl);
-	nand_release(&flctl->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	pm_runtime_disable(&pdev->dev);
 
 	return 0;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 48/62] mtd: rawnand: sharpsl: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:12   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/sharpsl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/sharpsl.c b/drivers/mtd/nand/raw/sharpsl.c
index b47a9eaff89b..d8c52a016080 100644
--- a/drivers/mtd/nand/raw/sharpsl.c
+++ b/drivers/mtd/nand/raw/sharpsl.c
@@ -183,7 +183,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
 	return 0;
 
 err_add:
-	nand_release(this);
+	nand_cleanup(this);
 
 err_scan:
 	iounmap(sharpsl->io);
-- 
2.20.1


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

* [PATCH 48/62] mtd: rawnand: sharpsl: Fix the probe error path
@ 2020-05-10 12:12   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/sharpsl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/sharpsl.c b/drivers/mtd/nand/raw/sharpsl.c
index b47a9eaff89b..d8c52a016080 100644
--- a/drivers/mtd/nand/raw/sharpsl.c
+++ b/drivers/mtd/nand/raw/sharpsl.c
@@ -183,7 +183,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
 	return 0;
 
 err_add:
-	nand_release(this);
+	nand_cleanup(this);
 
 err_scan:
 	iounmap(sharpsl->io);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 49/62] mtd: rawnand: sharpsl: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (47 preceding siblings ...)
  2020-05-10 12:12   ` Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12   ` Miquel Raynal
                   ` (13 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/sharpsl.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/sharpsl.c b/drivers/mtd/nand/raw/sharpsl.c
index d8c52a016080..51286f7acf54 100644
--- a/drivers/mtd/nand/raw/sharpsl.c
+++ b/drivers/mtd/nand/raw/sharpsl.c
@@ -199,13 +199,19 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
 static int sharpsl_nand_remove(struct platform_device *pdev)
 {
 	struct sharpsl_nand *sharpsl = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &sharpsl->chip;
+	int ret;
 
-	/* Release resources, unregister device */
-	nand_release(&sharpsl->chip);
+	/* Unregister device */
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+
+	/* Release resources */
+	nand_cleanup(chip);
 
 	iounmap(sharpsl->io);
 
-	/* Free the MTD device structure */
+	/* Free the driver's structure */
 	kfree(sharpsl);
 
 	return 0;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 50/62] mtd: ranwnand: socrates: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:12   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/socrates_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/socrates_nand.c b/drivers/mtd/nand/raw/socrates_nand.c
index 20f40c0e812c..7c94fc51a611 100644
--- a/drivers/mtd/nand/raw/socrates_nand.c
+++ b/drivers/mtd/nand/raw/socrates_nand.c
@@ -169,7 +169,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)
 	if (!res)
 		return res;
 
-	nand_release(nand_chip);
+	nand_cleanup(nand_chip);
 
 out:
 	iounmap(host->io_base);
-- 
2.20.1


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

* [PATCH 50/62] mtd: ranwnand: socrates: Fix the probe error path
@ 2020-05-10 12:12   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/socrates_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/socrates_nand.c b/drivers/mtd/nand/raw/socrates_nand.c
index 20f40c0e812c..7c94fc51a611 100644
--- a/drivers/mtd/nand/raw/socrates_nand.c
+++ b/drivers/mtd/nand/raw/socrates_nand.c
@@ -169,7 +169,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)
 	if (!res)
 		return res;
 
-	nand_release(nand_chip);
+	nand_cleanup(nand_chip);
 
 out:
 	iounmap(host->io_base);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 51/62] mtd: rawnand: socrates: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (49 preceding siblings ...)
  2020-05-10 12:12   ` Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 52/62] mtd: rawnand: stm32_fmc2: " Miquel Raynal
                   ` (11 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/socrates_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/socrates_nand.c b/drivers/mtd/nand/raw/socrates_nand.c
index 7c94fc51a611..243b34cfbc1b 100644
--- a/drivers/mtd/nand/raw/socrates_nand.c
+++ b/drivers/mtd/nand/raw/socrates_nand.c
@@ -182,8 +182,12 @@ static int socrates_nand_probe(struct platform_device *ofdev)
 static int socrates_nand_remove(struct platform_device *ofdev)
 {
 	struct socrates_nand_host *host = dev_get_drvdata(&ofdev->dev);
+	struct nand_chip *chip = &host->nand_chip;
+	int ret;
 
-	nand_release(&host->nand_chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	iounmap(host->io_base);
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 52/62] mtd: rawnand: stm32_fmc2: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (50 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 51/62] mtd: rawnand: socrates: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-13  7:48   ` Christophe Kerello
  2020-05-10 12:12   ` Miquel Raynal
                   ` (10 subsequent siblings)
  62 siblings, 1 reply; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/stm32_fmc2_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index c5fde09e0175..a0eb99ab0de8 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -2030,8 +2030,12 @@ static int stm32_fmc2_remove(struct platform_device *pdev)
 {
 	struct stm32_fmc2_nfc *fmc2 = platform_get_drvdata(pdev);
 	struct stm32_fmc2_nand *nand = &fmc2->nand;
+	struct nand_chip *chip = &nand->chip;
+	int ret;
 
-	nand_release(&nand->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	if (fmc2->dma_ecc_ch)
 		dma_release_channel(fmc2->dma_ecc_ch);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 53/62] mtd: rawnand: sunxi: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:12   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/sunxi_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 26d862213cac..9f51fd20a52e 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -2004,7 +2004,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret) {
 		dev_err(dev, "failed to register mtd device: %d\n", ret);
-		nand_release(nand);
+		nand_cleanup(nand);
 		return ret;
 	}
 
-- 
2.20.1


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

* [PATCH 53/62] mtd: rawnand: sunxi: Fix the probe error path
@ 2020-05-10 12:12   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/sunxi_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 26d862213cac..9f51fd20a52e 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -2004,7 +2004,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret) {
 		dev_err(dev, "failed to register mtd device: %d\n", ret);
-		nand_release(nand);
+		nand_cleanup(nand);
 		return ret;
 	}
 
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 54/62] mtd: rawnand: sunxi: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (52 preceding siblings ...)
  2020-05-10 12:12   ` Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 55/62] mtd: rawnand: tango: " Miquel Raynal
                   ` (8 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/sunxi_nand.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 9f51fd20a52e..ffbc1651fadc 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -2039,13 +2039,18 @@ static int sunxi_nand_chips_init(struct device *dev, struct sunxi_nfc *nfc)
 static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
 {
 	struct sunxi_nand_chip *sunxi_nand;
+	struct nand_chip *chip;
+	int ret;
 
 	while (!list_empty(&nfc->chips)) {
 		sunxi_nand = list_first_entry(&nfc->chips,
 					      struct sunxi_nand_chip,
 					      node);
-		nand_release(&sunxi_nand->nand);
-		sunxi_nand_ecc_cleanup(&sunxi_nand->nand.ecc);
+		chip = &sunxi_nand->nand;
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
+		sunxi_nand_ecc_cleanup(&chip->ecc);
 		list_del(&sunxi_nand->node);
 	}
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 55/62] mtd: rawnand: tango: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (53 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 54/62] mtd: rawnand: sunxi: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12   ` Miquel Raynal
                   ` (7 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/tango_nand.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/tango_nand.c b/drivers/mtd/nand/raw/tango_nand.c
index b92de603e6db..246871e01027 100644
--- a/drivers/mtd/nand/raw/tango_nand.c
+++ b/drivers/mtd/nand/raw/tango_nand.c
@@ -600,14 +600,19 @@ static int chip_init(struct device *dev, struct device_node *np)
 
 static int tango_nand_remove(struct platform_device *pdev)
 {
-	int cs;
 	struct tango_nfc *nfc = platform_get_drvdata(pdev);
+	struct nand_chip *chip;
+	int cs, ret;
 
 	dma_release_channel(nfc->chan);
 
 	for (cs = 0; cs < MAX_CS; ++cs) {
-		if (nfc->chips[cs])
-			nand_release(&nfc->chips[cs]->nand_chip);
+		if (nfc->chips[cs]) {
+			chip = &nfc->chips[cs]->nand_chip;
+			ret = mtd_device_unregister(nand_to_mtd(chip));
+			WARN_ON(ret);
+			nand_cleanup(chip);
+		}
 	}
 
 	return 0;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 56/62] mtd: rawnand: tmio: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:12   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/tmio_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/tmio_nand.c b/drivers/mtd/nand/raw/tmio_nand.c
index db030f1701ee..4e9a6d94f6e8 100644
--- a/drivers/mtd/nand/raw/tmio_nand.c
+++ b/drivers/mtd/nand/raw/tmio_nand.c
@@ -448,7 +448,7 @@ static int tmio_probe(struct platform_device *dev)
 	if (!retval)
 		return retval;
 
-	nand_release(nand_chip);
+	nand_cleanup(nand_chip);
 
 err_irq:
 	tmio_hw_stop(dev, tmio);
-- 
2.20.1


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

* [PATCH 56/62] mtd: rawnand: tmio: Fix the probe error path
@ 2020-05-10 12:12   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates by far the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/tmio_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/tmio_nand.c b/drivers/mtd/nand/raw/tmio_nand.c
index db030f1701ee..4e9a6d94f6e8 100644
--- a/drivers/mtd/nand/raw/tmio_nand.c
+++ b/drivers/mtd/nand/raw/tmio_nand.c
@@ -448,7 +448,7 @@ static int tmio_probe(struct platform_device *dev)
 	if (!retval)
 		return retval;
 
-	nand_release(nand_chip);
+	nand_cleanup(nand_chip);
 
 err_irq:
 	tmio_hw_stop(dev, tmio);
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 57/62] mtd: rawnand: tmio: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (55 preceding siblings ...)
  2020-05-10 12:12   ` Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 58/62] mtd: rawnand: txx9ndfmc: " Miquel Raynal
                   ` (5 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/tmio_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/tmio_nand.c b/drivers/mtd/nand/raw/tmio_nand.c
index 4e9a6d94f6e8..843a8683b737 100644
--- a/drivers/mtd/nand/raw/tmio_nand.c
+++ b/drivers/mtd/nand/raw/tmio_nand.c
@@ -458,8 +458,12 @@ static int tmio_probe(struct platform_device *dev)
 static int tmio_remove(struct platform_device *dev)
 {
 	struct tmio_nand *tmio = platform_get_drvdata(dev);
+	struct nand_chip *chip = &tmio->chip;
+	int ret;
 
-	nand_release(&tmio->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	tmio_hw_stop(dev, tmio);
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 58/62] mtd: rawnand: txx9ndfmc: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (56 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 57/62] mtd: rawnand: tmio: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 59/62] mtd: rawnand: vf610: " Miquel Raynal
                   ` (4 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/txx9ndfmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/txx9ndfmc.c b/drivers/mtd/nand/raw/txx9ndfmc.c
index 2642d5bb3241..47d966871445 100644
--- a/drivers/mtd/nand/raw/txx9ndfmc.c
+++ b/drivers/mtd/nand/raw/txx9ndfmc.c
@@ -371,7 +371,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
 static int __exit txx9ndfmc_remove(struct platform_device *dev)
 {
 	struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev);
-	int i;
+	int ret, i;
 
 	if (!drvdata)
 		return 0;
@@ -385,7 +385,9 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev)
 		chip = mtd_to_nand(mtd);
 		txx9_priv = nand_get_controller_data(chip);
 
-		nand_release(chip);
+		ret = mtd_device_unregister(nand_to_mtd(chip));
+		WARN_ON(ret);
+		nand_cleanup(chip);
 		kfree(txx9_priv->mtdname);
 		kfree(txx9_priv);
 	}
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 59/62] mtd: rawnand: vf610: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (57 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 58/62] mtd: rawnand: txx9ndfmc: " Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12   ` Miquel Raynal
                   ` (3 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Stefan Agner, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Stefan Agner <stefan@agner.ch>
---
 drivers/mtd/nand/raw/vf610_nfc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index bd9e16de78a2..7248c5901183 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -917,8 +917,12 @@ static int vf610_nfc_probe(struct platform_device *pdev)
 static int vf610_nfc_remove(struct platform_device *pdev)
 {
 	struct vf610_nfc *nfc = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &nfc->chip;
+	int ret;
 
-	nand_release(&nfc->chip);
+	ret = mtd_device_unregister(nand_to_mtd(chip));
+	WARN_ON(ret);
+	nand_cleanup(chip);
 	clk_disable_unprepare(nfc->clk);
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 60/62] mtd: rawnand: xway: Fix the probe error path
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
@ 2020-05-10 12:12   ` Miquel Raynal
  2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
                     ` (61 subsequent siblings)
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal, stable

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/xway_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/xway_nand.c b/drivers/mtd/nand/raw/xway_nand.c
index 834f794816a9..018311dc8fe1 100644
--- a/drivers/mtd/nand/raw/xway_nand.c
+++ b/drivers/mtd/nand/raw/xway_nand.c
@@ -210,7 +210,7 @@ static int xway_nand_probe(struct platform_device *pdev)
 
 	err = mtd_device_register(mtd, NULL, 0);
 	if (err)
-		nand_release(&data->chip);
+		nand_cleanup(&data->chip);
 
 	return err;
 }
-- 
2.20.1


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

* [PATCH 60/62] mtd: rawnand: xway: Fix the probe error path
@ 2020-05-10 12:12   ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, stable, Miquel Raynal

nand_release() is supposed be called after MTD device registration.
Here, only nand_scan() happened, so use nand_cleanup() instead.

There is no real Fixes tag applying here as the use of nand_release()
in this driver predates the introduction of nand_cleanup() in
commit d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
which makes this change possible. However, pointing this commit as the
culprit for backporting purposes makes sense even if this commit is not
introducing any bug.

Fixes: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/nand/raw/xway_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/xway_nand.c b/drivers/mtd/nand/raw/xway_nand.c
index 834f794816a9..018311dc8fe1 100644
--- a/drivers/mtd/nand/raw/xway_nand.c
+++ b/drivers/mtd/nand/raw/xway_nand.c
@@ -210,7 +210,7 @@ static int xway_nand_probe(struct platform_device *pdev)
 
 	err = mtd_device_register(mtd, NULL, 0);
 	if (err)
-		nand_release(&data->chip);
+		nand_cleanup(&data->chip);
 
 	return err;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 61/62] mtd: rawnand: xway: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (59 preceding siblings ...)
  2020-05-10 12:12   ` Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-10 12:12 ` [PATCH 62/62] mtd: rawnand: " Miquel Raynal
  2020-05-11  2:46 ` [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Masahiro Yamada
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/xway_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/xway_nand.c b/drivers/mtd/nand/raw/xway_nand.c
index 018311dc8fe1..94bfba994326 100644
--- a/drivers/mtd/nand/raw/xway_nand.c
+++ b/drivers/mtd/nand/raw/xway_nand.c
@@ -221,8 +221,12 @@ static int xway_nand_probe(struct platform_device *pdev)
 static int xway_nand_remove(struct platform_device *pdev)
 {
 	struct xway_nand_data *data = platform_get_drvdata(pdev);
+	struct nand_chip *chip = &data->chip;
+	int ret;
 
-	nand_release(&data->chip);
+	ret = mtd_device_unregister(mtd);
+	WARN_ON(ret);
+	nand_cleanup(chip);
 
 	return 0;
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 62/62] mtd: rawnand: Stop using nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (60 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 61/62] mtd: rawnand: xway: Stop using nand_release() Miquel Raynal
@ 2020-05-10 12:12 ` Miquel Raynal
  2020-05-11  2:46 ` [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Masahiro Yamada
  62 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-10 12:12 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus, linux-mtd
  Cc: Jonathan Corbet, Boris Brezillon, Miquel Raynal

This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Now that all drivers have been converted to do not use nand_release()
anymore, let's remove this helper.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Jonathan Corbet <corbet@lwn.net>
---
 Documentation/driver-api/mtdnand.rst |  6 ++++--
 drivers/mtd/nand/raw/nand_base.c     | 12 ------------
 include/linux/mtd/bbm.h              |  2 +-
 include/linux/mtd/rawnand.h          |  2 --
 4 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/Documentation/driver-api/mtdnand.rst b/Documentation/driver-api/mtdnand.rst
index 55447659b81f..0bf8d6ec3f54 100644
--- a/Documentation/driver-api/mtdnand.rst
+++ b/Documentation/driver-api/mtdnand.rst
@@ -276,8 +276,10 @@ unregisters the partitions in the MTD layer.
     #ifdef MODULE
     static void __exit board_cleanup (void)
     {
-        /* Release resources, unregister device */
-        nand_release (mtd_to_nand(board_mtd));
+        /* Unregister device */
+        WARN_ON(mtd_device_unregister(board_mtd));
+        /* Release resources */
+        nand_cleanup(mtd_to_nand(board_mtd));
 
         /* unmap physical address */
         iounmap(baseaddr);
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index d3b3b929e038..35fe18906662 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -6116,18 +6116,6 @@ void nand_cleanup(struct nand_chip *chip)
 
 EXPORT_SYMBOL_GPL(nand_cleanup);
 
-/**
- * nand_release - [NAND Interface] Unregister the MTD device and free resources
- *		  held by the NAND device
- * @chip: NAND chip object
- */
-void nand_release(struct nand_chip *chip)
-{
-	mtd_device_unregister(nand_to_mtd(chip));
-	nand_cleanup(chip);
-}
-EXPORT_SYMBOL_GPL(nand_release);
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Steven J. Hill <sjhill@realitydiluted.com>");
 MODULE_AUTHOR("Thomas Gleixner <tglx@linutronix.de>");
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 886e30441c90..d890805f5494 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -98,7 +98,7 @@ struct nand_bbt_descr {
 
 /*
  * Flag set by nand_create_default_bbt_descr(), marking that the nand_bbt_descr
- * was allocated dynamicaly and must be freed in nand_release(). Has no meaning
+ * was allocated dynamicaly and must be freed in nand_cleanup(). Has no meaning
  * in nand_chip.bbt_options.
  */
 #define NAND_BBT_DYNAMICSTRUCT	0x80000000
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 8159bd818536..3b955d4bb180 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -1388,8 +1388,6 @@ void nand_wait_ready(struct nand_chip *chip);
  * sucessful nand_scan().
  */
 void nand_cleanup(struct nand_chip *chip);
-/* Unregister the MTD device and calls nand_cleanup() */
-void nand_release(struct nand_chip *chip);
 
 /*
  * External helper for controller drivers that have to implement the WAITRDY
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 00/62] mtd: rawnand: Get rid of nand_release()
  2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
                   ` (61 preceding siblings ...)
  2020-05-10 12:12 ` [PATCH 62/62] mtd: rawnand: " Miquel Raynal
@ 2020-05-11  2:46 ` Masahiro Yamada
  62 siblings, 0 replies; 95+ messages in thread
From: Masahiro Yamada @ 2020-05-11  2:46 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Maxim Levitsky, Jonathan Corbet, Richard Weinberger,
	Tudor Ambarus, Stefan Agner, Paul Cercueil, Boris Brezillon,
	linux-mtd, Kamal Dasu, Harvey Hunt, Han Xu, Xiaolei Li,
	Brian Norris, Piotr Sroka, Vignesh Raghavendra

Hi Miquel,


On Sun, May 10, 2020 at 9:14 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hello,
>
> The main goal of this big cleanup series is to get rid of
> nand_release(). I am always confused when it comes to use either
> nand_cleanup() or nand_release() and I need to check the code in the
> core, which is a sign of the API being badly designed.
>
> Historically, there was a "nand_release()" helper only, doing the MTD
> device unregistration and cleaning/freeing all objects belonging to
> the NAND core. Later (v4.9), nand_cleanup() was been added to take
> care of all the NAND cleanup, and was called directly by
> nand_release(). This new helper was very useful to cleanup all the
> NAND core objects in one go on _probe() error (after a successful
> nand_scan()).
>
> Unfortunately, because of the lack of symmetry in the API, a lot of
> people also used nand_release wrongly in the _probe() error path.
>
> So now, instead of:
>
>         nand_release(chip);
>
> I would like people to use:
>
>         ret = mtd_device_unregister(mtd);
>         WARN_ON(ret);
>         nand_cleanup(chip);
>
> Note: as it is currently not possible to handle properly an error on
> mtd_device_unregister(), WARN_ON() will at least inform the user.
>
> All of you receiving this cover letter will at least receive one patch
> applying this change to the driver you are maintaining.
>
> Thanks,
> Miquèl



At first, I just wondered
if we could add nand_register()
that wraps the combo of
nand_scan() and mtd_device_register()
so that nand_register() vs nand_release()
looks symmetrical.


But, not all drivers call
nand_scan() and mtd_device_register()
in a row.

So, I agree we should simply drop
nand_release().


Thanks.

-- 
Best Regards
Masahiro Yamada

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 10/62] mtd: rawnand: denali: Delete items from the list in the _remove() path
  2020-05-10 12:11 ` [PATCH 10/62] mtd: rawnand: denali: Delete items from the list in the _remove() path Miquel Raynal
@ 2020-05-11  2:47   ` Masahiro Yamada
  0 siblings, 0 replies; 95+ messages in thread
From: Masahiro Yamada @ 2020-05-11  2:47 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Boris Brezillon, linux-mtd,
	Vignesh Raghavendra, Tudor Ambarus

On Sun, May 10, 2020 at 9:15 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Denali driver keeps track of devices with a list. Delete items of this
> list as long as they are not in use anymore.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>

Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>



> ---
>  drivers/mtd/nand/raw/denali.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
> index d40f9c8e2241..227474ca7743 100644
> --- a/drivers/mtd/nand/raw/denali.c
> +++ b/drivers/mtd/nand/raw/denali.c
> @@ -1336,10 +1336,12 @@ EXPORT_SYMBOL(denali_init);
>
>  void denali_remove(struct denali_controller *denali)
>  {
> -       struct denali_chip *dchip;
> +       struct denali_chip *dchip, *tmp;
>
> -       list_for_each_entry(dchip, &denali->chips, node)
> +       list_for_each_entry_safe(dchip, tmp, &denali->chips, node) {
>                 nand_release(&dchip->chip);
> +               list_del(&dchip->node);
> +       }
>
>         denali_disable_irq(denali);
>  }
> --
> 2.20.1
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



-- 
Best Regards
Masahiro Yamada

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 11/62] mtd: rawnand: denali: Stop using nand_release()
  2020-05-10 12:11 ` [PATCH 11/62] mtd: rawnand: denali: Stop using nand_release() Miquel Raynal
@ 2020-05-11  2:49   ` Masahiro Yamada
  0 siblings, 0 replies; 95+ messages in thread
From: Masahiro Yamada @ 2020-05-11  2:49 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Boris Brezillon, linux-mtd,
	Vignesh Raghavendra, Tudor Ambarus

On Sun, May 10, 2020 at 9:16 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> This helper is not very useful and very often people get confused:
> they use nand_release() instead of nand_cleanup().
>
> Let's stop using nand_release() by calling mtd_device_unregister() and
> nand_cleanup() directly.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>


Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>



-- 
Best Regards
Masahiro Yamada

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 45/62] mtd: rawnand: r852: Stop using nand_release()
  2020-05-10 12:12 ` [PATCH 45/62] mtd: rawnand: r852: " Miquel Raynal
@ 2020-05-11 10:33   ` Sergei Shtylyov
  2020-05-11 13:10     ` Miquel Raynal
  0 siblings, 1 reply; 95+ messages in thread
From: Sergei Shtylyov @ 2020-05-11 10:33 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon, Maxim Levitsky

Hello

On 10.05.2020 15:12, Miquel Raynal wrote:

> This helper is not very useful and very often people get confused:
> they use nand_release() instead of nand_cleanup().
> 
> Let's stop using nand_release() by calling mtd_device_unregister() and
> nand_cleanup() directly.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Maxim Levitsky <maximlevitsky@gmail.com>
> ---
>   drivers/mtd/nand/raw/r852.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
> index 77774250fb11..f865e3a47b01 100644
> --- a/drivers/mtd/nand/raw/r852.c
> +++ b/drivers/mtd/nand/raw/r852.c
> @@ -651,7 +651,8 @@ static int r852_register_nand_device(struct r852_device *dev)
>   	dev->card_registered = 1;
>   	return 0;
>   error3:
> -	nand_release(dev->chip);
> +	WARN_ON(mtd_device_unregister(nand_to_mtd(dev->chip)));

    Sometimes you declare a variable to receive the result, sometimes (more 
seldom) you don't... What guides you?

[...]

MBR, Sergei

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 45/62] mtd: rawnand: r852: Stop using nand_release()
  2020-05-11 10:33   ` Sergei Shtylyov
@ 2020-05-11 13:10     ` Miquel Raynal
  2020-05-12 20:09       ` Sergei Shtylyov
  0 siblings, 1 reply; 95+ messages in thread
From: Miquel Raynal @ 2020-05-11 13:10 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Maxim Levitsky, Tudor Ambarus, Richard Weinberger,
	Boris Brezillon, linux-mtd, Vignesh Raghavendra

Hi Sergei,

Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote on Mon, 11
May 2020 13:33:01 +0300:

> Hello
> 
> On 10.05.2020 15:12, Miquel Raynal wrote:
> 
> > This helper is not very useful and very often people get confused:
> > they use nand_release() instead of nand_cleanup().
> > 
> > Let's stop using nand_release() by calling mtd_device_unregister() and
> > nand_cleanup() directly.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > Cc: Maxim Levitsky <maximlevitsky@gmail.com>
> > ---
> >   drivers/mtd/nand/raw/r852.c | 6 ++++--
> >   1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
> > index 77774250fb11..f865e3a47b01 100644
> > --- a/drivers/mtd/nand/raw/r852.c
> > +++ b/drivers/mtd/nand/raw/r852.c
> > @@ -651,7 +651,8 @@ static int r852_register_nand_device(struct r852_device *dev)
> >   	dev->card_registered = 1;
> >   	return 0;
> >   error3:
> > -	nand_release(dev->chip);
> > +	WARN_ON(mtd_device_unregister(nand_to_mtd(dev->chip)));  
> 
>     Sometimes you declare a variable to receive the result, sometimes (more seldom) you don't... What guides you?

Absolutely. The logic (if any) was:

Use "ret", unless I think it does not fit very well the driver's style
or the location where I put it. So in the end, as I consider that both
are totally fine, it's a bit mixed and the choice very personnal. Do you
think it is a problem?

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 45/62] mtd: rawnand: r852: Stop using nand_release()
  2020-05-11 13:10     ` Miquel Raynal
@ 2020-05-12 20:09       ` Sergei Shtylyov
  0 siblings, 0 replies; 95+ messages in thread
From: Sergei Shtylyov @ 2020-05-12 20:09 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Maxim Levitsky, Tudor Ambarus, Richard Weinberger,
	Boris Brezillon, linux-mtd, Vignesh Raghavendra

On 05/11/2020 04:10 PM, Miquel Raynal wrote:

>>> This helper is not very useful and very often people get confused:
>>> they use nand_release() instead of nand_cleanup().
>>>
>>> Let's stop using nand_release() by calling mtd_device_unregister() and
>>> nand_cleanup() directly.
>>>
>>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>> Cc: Maxim Levitsky <maximlevitsky@gmail.com>
>>> ---
>>>   drivers/mtd/nand/raw/r852.c | 6 ++++--
>>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
>>> index 77774250fb11..f865e3a47b01 100644
>>> --- a/drivers/mtd/nand/raw/r852.c
>>> +++ b/drivers/mtd/nand/raw/r852.c
>>> @@ -651,7 +651,8 @@ static int r852_register_nand_device(struct r852_device *dev)
>>>   	dev->card_registered = 1;
>>>   	return 0;
>>>   error3:
>>> -	nand_release(dev->chip);
>>> +	WARN_ON(mtd_device_unregister(nand_to_mtd(dev->chip)));  
>>
>>     Sometimes you declare a variable to receive the result, sometimes (more seldom) you don't... What guides you?
> 
> Absolutely. The logic (if any) was:
> 
> Use "ret", unless I think it does not fit very well the driver's style
> or the location where I put it. So in the end, as I consider that both
> are totally fine, it's a bit mixed and the choice very personnal. Do you
> think it is a problem?

   No, I was doubtful about the one-time evaluation of the WARN_ON()'s 1st argument
but then realized that it's taking care of...

> Thanks,
> Miquèl

MBR, Sergei

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 50/62] mtd: ranwnand: socrates: Fix the probe error path
  2020-05-10 12:12   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 33/62] mtd: rawnand: orion: Fix the probe error path
  2020-05-10 12:11   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 40/62] mtd: rawnand: pasemi: Fix the probe error path
  2020-05-10 12:11   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Build OK!
v4.14.179: Failed to apply! Possible dependencies:
    Unable to calculate

v4.9.222: Failed to apply! Possible dependencies:
    Unable to calculate


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 42/62] mtd: rawnand: plat_nand: Fix the probe error path
  2020-05-10 12:12   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 21/62] mtd: rawnand: ingenic: Fix the probe error path
  2020-05-10 12:11   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, Paul Cercueil, Harvey Hunt, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 60/62] mtd: rawnand: xway: Fix the probe error path
  2020-05-10 12:12   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 48/62] mtd: rawnand: sharpsl: Fix the probe error path
  2020-05-10 12:12   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 53/62] mtd: rawnand: sunxi: Fix the probe error path
  2020-05-10 12:12   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222, v4.4.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")

v4.4.222: Failed to apply! Possible dependencies:
    2cca45574007 ("Merge tag 'topic/drm-misc-2016-06-07' of git://anongit.freedesktop.org/drm-intel into drm-next")
    47cb398dd75a ("Docs: sphinxify device-drivers.tmpl")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    5b996e93aac3 ("Documentation: include sync_file into DocBook")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    eae1760fc838 ("doc: update/fixup dma-buf related DocBook")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 27/62] mtd: rawnand: mtk: Fix the probe error path
  2020-05-10 12:11   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, Xiaolei Li, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 36/62] mtd: rawnand: oxnas: Fix the probe error path
  2020-05-10 12:11   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
    4b17cf680c0c ("mtd: rawnand: diskonchip: Fix the probe error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    1c782b9a8517 ("mtd: nand: mtk: change the compile sequence of mtk_nand.o and mtk_ecc.o")
    263c68afb521 ("mtd: nand: pxa3xx_nand: Update Kconfig information")
    34832dc44d44 ("mtd: nand: gpmi-nand: Remove wrong Kconfig help text")
    4b17cf680c0c ("mtd: rawnand: diskonchip: Fix the probe error path")
    577e010c24bc ("mtd: rawnand: atmel: convert driver to nand_scan()")
    7928225ffcb3 ("mtd: rawnand: atmel: clarify NAND addition/removal paths")
    7cce5d835467 ("MAINTAINERS: mtd/nand: update Microchip nand entry")
    7da45139d264 ("mtd: rawnand: better name for the controller structure")
    93db446a424c ("mtd: nand: move raw NAND related code to the raw/ subdir")
    b4525db6f0c6 ("MAINTAINERS: Add entry for Marvell NAND controller driver")
    d7d9f8ec77fe ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")

v4.9.222: Failed to apply! Possible dependencies:
    00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    4b17cf680c0c ("mtd: rawnand: diskonchip: Fix the probe error path")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 56/62] mtd: rawnand: tmio: Fix the probe error path
  2020-05-10 12:12   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  -1 siblings, 0 replies; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    256c4fc76a80 ("mtd: rawnand: add a way to pass an ID table with nand_scan()")
    39b77c586e17 ("mtd: rawnand: fsl_elbc: fix probe function error path")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    63fa37f0c512 ("mtd: rawnand: Replace printk() with appropriate pr_*() macro")
    97d90da8a886 ("mtd: nand: provide several helpers to do common NAND operations")
    98732da1a08e ("mtd: rawnand: do not export nand_scan_[ident|tail]() anymore")
    acfc33091f7a ("mtd: rawnand: fsl_ifc: fix probe function error path")

v4.9.222: Failed to apply! Possible dependencies:
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 12/62] mtd: rawnand: diskonchip: Fix the probe error path
  2020-05-10 12:11   ` Miquel Raynal
  (?)
@ 2020-05-13  0:49   ` Sasha Levin
  2020-05-13  7:59     ` Miquel Raynal
  -1 siblings, 1 reply; 95+ messages in thread
From: Sasha Levin @ 2020-05-13  0:49 UTC (permalink / raw)
  To: Sasha Levin, Miquel Raynal, Richard Weinberger
  Cc: Boris Brezillon, stable, stable

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag
fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.

v5.6.11: Build OK!
v5.4.39: Build OK!
v4.19.121: Failed to apply! Possible dependencies:
    00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
    59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")

v4.14.179: Failed to apply! Possible dependencies:
    00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
    02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
    1c782b9a8517 ("mtd: nand: mtk: change the compile sequence of mtk_nand.o and mtk_ecc.o")
    263c68afb521 ("mtd: nand: pxa3xx_nand: Update Kconfig information")
    34832dc44d44 ("mtd: nand: gpmi-nand: Remove wrong Kconfig help text")
    577e010c24bc ("mtd: rawnand: atmel: convert driver to nand_scan()")
    7928225ffcb3 ("mtd: rawnand: atmel: clarify NAND addition/removal paths")
    7cce5d835467 ("MAINTAINERS: mtd/nand: update Microchip nand entry")
    7da45139d264 ("mtd: rawnand: better name for the controller structure")
    93db446a424c ("mtd: nand: move raw NAND related code to the raw/ subdir")
    b4525db6f0c6 ("MAINTAINERS: Add entry for Marvell NAND controller driver")
    d7d9f8ec77fe ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")

v4.9.222: Failed to apply! Possible dependencies:
    00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
    24755a55b01f ("Documentation/00-index: update for new core-api folder")
    4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
    609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
    66115335fbb4 ("docs: Fix build failure")
    7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
    8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
    90f9f118b75c ("docs-rst: convert filesystems book to ReST")
    93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
    c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
    d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
    e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
    f3fc83e55533 ("docs: Fix htmldocs build failure")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

-- 
Thanks
Sasha

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

* Re: [PATCH 52/62] mtd: rawnand: stm32_fmc2: Stop using nand_release()
  2020-05-10 12:12 ` [PATCH 52/62] mtd: rawnand: stm32_fmc2: " Miquel Raynal
@ 2020-05-13  7:48   ` Christophe Kerello
  0 siblings, 0 replies; 95+ messages in thread
From: Christophe Kerello @ 2020-05-13  7:48 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Tudor Ambarus, linux-mtd
  Cc: Boris Brezillon

Hi Miquel,

On 5/10/20 2:12 PM, Miquel Raynal wrote:
> This helper is not very useful and very often people get confused:
> they use nand_release() instead of nand_cleanup().
> 
> Let's stop using nand_release() by calling mtd_device_unregister() and
> nand_cleanup() directly.
> 
> Signed-off-by: Miquel Raynal<miquel.raynal@bootlin.com>
> ---

Reviewed-by: Christophe Kerello <christophe.kerello@st.com>

Regards,
Christophe Kerello.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 12/62] mtd: rawnand: diskonchip: Fix the probe error path
  2020-05-13  0:49   ` Sasha Levin
@ 2020-05-13  7:59     ` Miquel Raynal
  0 siblings, 0 replies; 95+ messages in thread
From: Miquel Raynal @ 2020-05-13  7:59 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Richard Weinberger, Boris Brezillon, stable

Hi Sasha,

Sasha Levin <sashal@kernel.org> wrote on Wed, 13 May 2020 00:49:39
+0000:

> Hi
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag
> fixing commit: d44154f969a4 ("mtd: nand: Provide nand_cleanup() function to free NAND related resources").
> 
> The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121, v4.14.179, v4.9.222.
> 
> v5.6.11: Build OK!
> v5.4.39: Build OK!
> v4.19.121: Failed to apply! Possible dependencies:
>     00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
>     59ac276f2227 ("mtd: rawnand: Pass a nand_chip object to nand_release()")
> 
> v4.14.179: Failed to apply! Possible dependencies:
>     00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
>     02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
>     1c782b9a8517 ("mtd: nand: mtk: change the compile sequence of mtk_nand.o and mtk_ecc.o")
>     263c68afb521 ("mtd: nand: pxa3xx_nand: Update Kconfig information")
>     34832dc44d44 ("mtd: nand: gpmi-nand: Remove wrong Kconfig help text")
>     577e010c24bc ("mtd: rawnand: atmel: convert driver to nand_scan()")
>     7928225ffcb3 ("mtd: rawnand: atmel: clarify NAND addition/removal paths")
>     7cce5d835467 ("MAINTAINERS: mtd/nand: update Microchip nand entry")
>     7da45139d264 ("mtd: rawnand: better name for the controller structure")
>     93db446a424c ("mtd: nand: move raw NAND related code to the raw/ subdir")
>     b4525db6f0c6 ("MAINTAINERS: Add entry for Marvell NAND controller driver")
>     d7d9f8ec77fe ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")
> 
> v4.9.222: Failed to apply! Possible dependencies:
>     00ad378f304a ("mtd: rawnand: Pass a nand_chip object to nand_scan()")
>     24755a55b01f ("Documentation/00-index: update for new core-api folder")
>     4ad4b21b1b81 ("docs-rst: convert usb docbooks to ReST")
>     609f212f6a12 ("docs-rst: convert mtdnand book to ReST")
>     66115335fbb4 ("docs: Fix build failure")
>     7ddedebb03b7 ("ALSA: doc: ReSTize writing-an-alsa-driver document")
>     8551914a5e19 ("ALSA: doc: ReSTize alsa-driver-api document")
>     90f9f118b75c ("docs-rst: convert filesystems book to ReST")
>     93dc3a112bf8 ("doc: Convert the debugobjects DocBook template to sphinx")
>     c441a4781ff1 ("crypto: doc - remove crypto API DocBook")
>     d6ba7a9c8b5a ("doc: Sphinxify the tracepoint docbook")
>     e7f08ffb1855 ("Documentation/workqueue.txt: convert to ReST markup")
>     f3fc83e55533 ("docs: Fix htmldocs build failure")
> 
> 
> NOTE: The patch will not be queued to stable trees until it is upstream.
> 
> How should we proceed with this patch?
> 

I knew applying these patches would quickly be an issue, I think
having these backported to the latest kernels is enough.

Thanks,
Miquèl

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

end of thread, other threads:[~2020-05-13  7:59 UTC | newest]

Thread overview: 95+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 12:11 [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Miquel Raynal
2020-05-10 12:11 ` [PATCH 01/62] mtd: rawnand: ams-delta: Stop using nand_release() Miquel Raynal
2020-05-10 12:11 ` [PATCH 02/62] mtd: rawnand: au1550nd: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 03/62] mtd: rawnand: bcm47xx: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 04/62] mtd: rawnand: brcmnand: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 05/62] mtd: rawnand: cadence: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 06/62] mtd: rawnand: cafe: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 07/62] mtd: rawnand: cmx270: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 08/62] mtd: rawnand: cs553x: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 09/62] mtd: rawnand: davinci: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 10/62] mtd: rawnand: denali: Delete items from the list in the _remove() path Miquel Raynal
2020-05-11  2:47   ` Masahiro Yamada
2020-05-10 12:11 ` [PATCH 11/62] mtd: rawnand: denali: Stop using nand_release() Miquel Raynal
2020-05-11  2:49   ` Masahiro Yamada
2020-05-10 12:11 ` [PATCH 12/62] mtd: rawnand: diskonchip: Fix the probe error path Miquel Raynal
2020-05-10 12:11   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-13  7:59     ` Miquel Raynal
2020-05-10 12:11 ` [PATCH 13/62] mtd: rawnand: diskonchip: Stop using nand_release() Miquel Raynal
2020-05-10 12:11 ` [PATCH 14/62] mtd: rawnand: fsl_elbc: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 15/62] mtd: rawnand: fsl_ifc: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 16/62] mtd: rawnand: fsl_upm: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 17/62] mtd: rawnand: fsmc: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 18/62] mtd: rawnand: gpio: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 19/62] mtd: rawnand: gpmi: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 20/62] mtd: rawnand: hisi504: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 21/62] mtd: rawnand: ingenic: Fix the probe error path Miquel Raynal
2020-05-10 12:11   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:11 ` [PATCH 22/62] mtd: rawnand: ingenic: Stop using nand_release() Miquel Raynal
2020-05-10 12:11 ` [PATCH 23/62] mtd: rawnand: lpc32xx_mlc: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 24/62] mtd: rawnand: lpc32xx_slc: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 25/62] mtd: rawnand: marvell: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 26/62] mtd: rawnand: mpc5121: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 27/62] mtd: rawnand: mtk: Fix the probe error path Miquel Raynal
2020-05-10 12:11   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:11 ` [PATCH 28/62] mtd: rawnand: mtk: Stop using nand_release() Miquel Raynal
2020-05-10 12:11 ` [PATCH 29/62] mtd: rawnand: mxc: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 30/62] mtd: rawnand: mxic: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 31/62] mtd: rawnand: ndfc: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 32/62] mtd: rawnand: omap2: " Miquel Raynal
2020-05-10 12:11 ` [PATCH 33/62] mtd: rawnand: orion: Fix the probe error path Miquel Raynal
2020-05-10 12:11   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:11 ` [PATCH 34/62] mtd: rawnand: orion: Stop using nand_release() Miquel Raynal
2020-05-10 12:11 ` [PATCH 35/62] mtd: rawnand: oxnas: Keep track of registered devices Miquel Raynal
2020-05-10 12:11 ` [PATCH 36/62] mtd: rawnand: oxnas: Fix the probe error path Miquel Raynal
2020-05-10 12:11   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:11 ` [PATCH 37/62] mtd: rawnand: oxnas: Unregister all devices on error Miquel Raynal
2020-05-10 12:11 ` [PATCH 38/62] mtd: rawnand: oxnas: Release all devices in the _remove() path Miquel Raynal
2020-05-10 12:11 ` [PATCH 39/62] mtd: rawnand: oxnas: Stop using nand_release() Miquel Raynal
2020-05-10 12:11 ` [PATCH 40/62] mtd: rawnand: pasemi: Fix the probe error path Miquel Raynal
2020-05-10 12:11   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:11 ` [PATCH 41/62] mtd: rawnand: pasemi: Stop using nand_release() Miquel Raynal
2020-05-10 12:12 ` [PATCH 42/62] mtd: rawnand: plat_nand: Fix the probe error path Miquel Raynal
2020-05-10 12:12   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:12 ` [PATCH 43/62] mtd: rawnand: plat_nand: Stop using nand_release() Miquel Raynal
2020-05-10 12:12 ` [PATCH 44/62] mtd: rawnand: qcom: " Miquel Raynal
2020-05-10 12:12 ` [PATCH 45/62] mtd: rawnand: r852: " Miquel Raynal
2020-05-11 10:33   ` Sergei Shtylyov
2020-05-11 13:10     ` Miquel Raynal
2020-05-12 20:09       ` Sergei Shtylyov
2020-05-10 12:12 ` [PATCH 46/62] mtd: rawnand: s3c2410: " Miquel Raynal
2020-05-10 12:12 ` [PATCH 47/62] mtd: rawnand: sh_flctl: " Miquel Raynal
2020-05-10 12:12 ` [PATCH 48/62] mtd: rawnand: sharpsl: Fix the probe error path Miquel Raynal
2020-05-10 12:12   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:12 ` [PATCH 49/62] mtd: rawnand: sharpsl: Stop using nand_release() Miquel Raynal
2020-05-10 12:12 ` [PATCH 50/62] mtd: ranwnand: socrates: Fix the probe error path Miquel Raynal
2020-05-10 12:12   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:12 ` [PATCH 51/62] mtd: rawnand: socrates: Stop using nand_release() Miquel Raynal
2020-05-10 12:12 ` [PATCH 52/62] mtd: rawnand: stm32_fmc2: " Miquel Raynal
2020-05-13  7:48   ` Christophe Kerello
2020-05-10 12:12 ` [PATCH 53/62] mtd: rawnand: sunxi: Fix the probe error path Miquel Raynal
2020-05-10 12:12   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:12 ` [PATCH 54/62] mtd: rawnand: sunxi: Stop using nand_release() Miquel Raynal
2020-05-10 12:12 ` [PATCH 55/62] mtd: rawnand: tango: " Miquel Raynal
2020-05-10 12:12 ` [PATCH 56/62] mtd: rawnand: tmio: Fix the probe error path Miquel Raynal
2020-05-10 12:12   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:12 ` [PATCH 57/62] mtd: rawnand: tmio: Stop using nand_release() Miquel Raynal
2020-05-10 12:12 ` [PATCH 58/62] mtd: rawnand: txx9ndfmc: " Miquel Raynal
2020-05-10 12:12 ` [PATCH 59/62] mtd: rawnand: vf610: " Miquel Raynal
2020-05-10 12:12 ` [PATCH 60/62] mtd: rawnand: xway: Fix the probe error path Miquel Raynal
2020-05-10 12:12   ` Miquel Raynal
2020-05-13  0:49   ` Sasha Levin
2020-05-10 12:12 ` [PATCH 61/62] mtd: rawnand: xway: Stop using nand_release() Miquel Raynal
2020-05-10 12:12 ` [PATCH 62/62] mtd: rawnand: " Miquel Raynal
2020-05-11  2:46 ` [PATCH 00/62] mtd: rawnand: Get rid of nand_release() Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.