[PATCH v2 00/62] mtd: rawnand: Get rid of nand_release()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux