linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/62] mtd: rawnand: Get rid of nand_release()
@ 2020-05-19 12:59 Miquel Raynal
  2020-05-19 12:59 ` [PATCH v2 01/62] mtd: rawnand: ams-delta: Stop using nand_release() Miquel Raynal
                   ` (61 more replies)
  0 siblings, 62 replies; 136+ messages in thread
From: Miquel Raynal @ 2020-05-19 12:59 UTC (permalink / raw)
  To: linux-mtd
  Cc: Christophe Kerello, Maxim Levitsky, Jonathan Corbet, Kamal Dasu,
	Stefan Agner, Paul Cercueil, Masahiro Yamada, Harvey Hunt,
	Miquel Raynal, Han Xu, Brian Norris

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

Note: as the modification are minor, I did not Cc: everybody in the
rest of the series due to the amount of patches.

Changes in v2:
* Removed Piotr and Xiaolei from the Cc: list (bouncing e-mails).
* Fixed a forgotten kfree() in the cs553x_nand.c driver remove path.
* Added Masahiro's Acked-by.
* Rebased on top of the latest nand/next.
* Added Christophe's Reviewed-by.
* Fixed a commit title with "ranwnand" in it.

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: rawnand: 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            |  5 ++-
 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(+), 110 deletions(-)

-- 
2.20.1


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

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

end of thread, other threads:[~2020-05-27 14:12 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).