All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org,
	Hartley Sweeten <hsweeten@visionengravers.com>,
	Ryan Mallon <rmallon@gmail.com>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	Imre Kaloz <kaloz@openwrt.org>,
	Krzysztof Halasa <khalasa@piap.pl>,
	Tony Lindgren <tony@atomide.com>,
	linux-omap@vger.kernel.org,
	Alexander Clouter <alex@digriz.org.uk>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Gregory CLEMENT <gregory.clement@free-electrons.com>,
	Jason Cooper <jason@lakedaemon.net>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>, Daniel Mack <daniel@zonque.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Marek Vasut <marek.vasut@gmail.com>,
	Steven Miao <realmz6@gmail.com>,
	adi-buildroot-devel@lists.sourceforge.net,
	Mikael Starvik <starvik@axis.com>,
	Jesper Nilsson <jesper.nilsson@axis.com>,
	linux-cris-kernel@axis.com, Josh Wu <josh.wu@atmel.com>,
	Wan ZongShun <mcuos.com@gmail.com>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	linux-samsung-soc@vger.kernel.org,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Chen-Yu Tsai <wens@csie.org>,
	linux-sunxi@googlegroups.com, Stefan Agner <stefan@agner.ch>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Boris Brezillon <boris.brezillon@free-electrons.com>
Subject: [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1)
Date: Tue,  1 Dec 2015 12:02:57 +0100	[thread overview]
Message-ID: <1448967802-25796-1-git-send-email-boris.brezillon@free-electrons.com> (raw)

Hello,

This huge series aims at clarifying the relationship between the mtd and
nand_chip structures and hiding NAND framework internals to NAND
controller drivers.

The first part of the series provide an mtd_to_nand() helper to hide the
way mtd and nand_chip are linked together.

The second part of the series embeds the mtd structure into the nand_chip
one so that NAND controller drivers don't have to bother allocating the
MTD device and linking it with the NAND chip.

The last part of the series hides accesses to the chip->priv field behind
two helper functions.

This allows removal of some of the boilerplate code done in all NAND
controller drivers, but most importantly, it unifies a bit the way NAND
chip structures are instantiated (even though we still have two different
kinds of drivers: those embedding the nand_chip struct into their private
nand chip representation, and those allocating two different structures
and linking them together with the chip->priv field).

As said in the title, this refactoring is only the first step. I plan to
rework the NAND controller / NAND chip separation for pretty much the same
reasons: clarifying the separation between the two concepts, and getting
rid of more boilerplate code in NAND controller drivers.

Stay tuned ;-).

Best Regards,

Boris

Changes since v1:
- dropped already applied patches
- fixed some typos
- manually fixed some modifications omitted by the coccinelle scripts
- manually reworked modifactions done by coccinelle scripts to improve
  readability and fix coding style issues

Boris Brezillon (25):
  ARM: nand: make use of mtd_to_nand() where appropriate
  blackfin: nand: make use of mtd_to_nand() where appropriate
  cris: nand: make use of mtd_to_nand() where appropriate
  mips: nand: make use of mtd_to_nand() where appropriate
  sh: nand: make use of mtd_to_nand() where appropriate
  mtd: nand: make use of mtd_to_nand() in NAND core code
  mtd: nand: make use of mtd_to_nand() in NAND drivers
  staging: mt29f_spinand: make use of mtd_to_nand()
  mtd: nand: embed an mtd_info structure into nand_chip
  mtd: nand: add nand_to_mtd() helper
  coccinelle: nand: detect and correct drivers embedding an mtd_info
    object
  mtd: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update the documentation to reflect framework changes
  staging: mt29f_spinand: use the mtd instance embedded in struct
    nand_chip
  cris: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update mtd_to_nand()
  mtd: nand: remove useless mtd->priv = chip assignments
  cris: nand: remove useless mtd->priv = chip assignments
  staging: mt29f_spinand: remove useless mtd->priv = chip assignment
  mtd: nand: simplify nand_dt_init() usage
  mtd: nand: kill the chip->flash_node field
  mtd: nand: add helpers to access ->priv
  ARM: make use of nand_set/get_controller_data() helpers
  mtd: nand: make use of nand_set/get_controller_data() helpers
  staging: mt29f_spinand: make use of nand_set/get_controller_data()
    helpers

 Documentation/DocBook/mtdnand.tmpl             |  31 +++---
 arch/arm/mach-ep93xx/snappercl15.c             |   4 +-
 arch/arm/mach-ep93xx/ts72xx.c                  |   4 +-
 arch/arm/mach-imx/mach-qong.c                  |   2 +-
 arch/arm/mach-ixp4xx/ixdp425-setup.c           |   6 +-
 arch/arm/mach-omap1/board-nand.c               |   2 +-
 arch/arm/mach-orion5x/ts78xx-setup.c           |   6 +-
 arch/arm/mach-pxa/balloon3.c                   |   2 +-
 arch/arm/mach-pxa/em-x270.c                    |   2 +-
 arch/arm/mach-pxa/palmtx.c                     |   2 +-
 arch/blackfin/mach-bf537/boards/stamp.c        |   2 +-
 arch/blackfin/mach-bf561/boards/acvilon.c      |   2 +-
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c |   8 +-
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c |   8 +-
 arch/mips/alchemy/devboards/db1200.c           |   2 +-
 arch/mips/alchemy/devboards/db1300.c           |   2 +-
 arch/mips/alchemy/devboards/db1550.c           |   2 +-
 arch/mips/pnx833x/common/platform.c            |   2 +-
 arch/mips/rb532/devices.c                      |   2 +-
 arch/sh/boards/mach-migor/setup.c              |   2 +-
 drivers/mtd/nand/ams-delta.c                   |  26 ++---
 drivers/mtd/nand/atmel_nand.c                  | 118 ++++++++++----------
 drivers/mtd/nand/au1550nd.c                    |  40 +++----
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |   1 -
 drivers/mtd/nand/bcm47xxnflash/main.c          |   9 +-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  34 +++---
 drivers/mtd/nand/bf5xx_nand.c                  |  25 ++---
 drivers/mtd/nand/brcmnand/brcmnand.c           |  54 +++++----
 drivers/mtd/nand/cafe_nand.c                   |  51 +++++----
 drivers/mtd/nand/cmx270_nand.c                 |  20 ++--
 drivers/mtd/nand/cs553x_nand.c                 |  30 +++--
 drivers/mtd/nand/davinci_nand.c                |  37 ++++---
 drivers/mtd/nand/denali.c                      |  67 ++++++-----
 drivers/mtd/nand/denali.h                      |   1 -
 drivers/mtd/nand/diskonchip.c                  | 148 ++++++++++++-------------
 drivers/mtd/nand/docg4.c                       |  91 ++++++++-------
 drivers/mtd/nand/fsl_elbc_nand.c               |  61 +++++-----
 drivers/mtd/nand/fsl_ifc_nand.c                |  71 ++++++------
 drivers/mtd/nand/fsl_upm.c                     |  31 +++---
 drivers/mtd/nand/fsmc_nand.c                   |  69 ++++++------
 drivers/mtd/nand/gpio.c                        |  19 ++--
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c          |   2 +-
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c         |  67 ++++++-----
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h         |   1 -
 drivers/mtd/nand/hisi504_nand.c                |  48 ++++----
 drivers/mtd/nand/jz4740_nand.c                 |  14 +--
 drivers/mtd/nand/lpc32xx_mlc.c                 |  32 +++---
 drivers/mtd/nand/lpc32xx_slc.c                 |  42 ++++---
 drivers/mtd/nand/mpc5121_nfc.c                 |  52 +++++----
 drivers/mtd/nand/mxc_nand.c                    |  76 +++++++------
 drivers/mtd/nand/nand_base.c                   | 102 +++++++++--------
 drivers/mtd/nand/nand_bbt.c                    |  32 +++---
 drivers/mtd/nand/nand_bch.c                    |   4 +-
 drivers/mtd/nand/nand_ecc.c                    |   4 +-
 drivers/mtd/nand/nandsim.c                     |  35 +++---
 drivers/mtd/nand/ndfc.c                        |  53 ++++-----
 drivers/mtd/nand/nuc900_nand.c                 |  25 ++---
 drivers/mtd/nand/omap2.c                       | 109 ++++++++++--------
 drivers/mtd/nand/orion_nand.c                  |  13 +--
 drivers/mtd/nand/pasemi_nand.c                 |  21 ++--
 drivers/mtd/nand/plat_nand.c                   |  16 +--
 drivers/mtd/nand/pxa3xx_nand.c                 |  70 ++++++------
 drivers/mtd/nand/r852.c                        |  41 +++----
 drivers/mtd/nand/r852.h                        |   1 -
 drivers/mtd/nand/s3c2410.c                     |  32 +++---
 drivers/mtd/nand/sh_flctl.c                    |   9 +-
 drivers/mtd/nand/sharpsl.c                     |  23 ++--
 drivers/mtd/nand/sm_common.c                   |   2 +-
 drivers/mtd/nand/socrates_nand.c               |  24 ++--
 drivers/mtd/nand/sunxi_nand.c                  |  40 ++++---
 drivers/mtd/nand/tmio_nand.c                   |  13 ++-
 drivers/mtd/nand/txx9ndfmc.c                   |  25 ++---
 drivers/mtd/nand/vf610_nfc.c                   |   9 +-
 drivers/mtd/nand/xway_nand.c                   |   4 +-
 drivers/staging/mt29f_spinand/mt29f_spinand.c  |  19 ++--
 include/linux/mtd/nand.h                       |  26 ++++-
 include/linux/mtd/sh_flctl.h                   |   3 +-
 scripts/coccinelle/api/nand-priv-no-mtd.cocci  |  91 +++++++++++++++
 78 files changed, 1179 insertions(+), 1097 deletions(-)
 create mode 100644 scripts/coccinelle/api/nand-priv-no-mtd.cocci

-- 
2.1.4


WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Brian Norris
	<computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Hartley Sweeten
	<hsweeten-3FF4nKcrg1dE2c76skzGb0EOCMrvLtNR@public.gmane.org>,
	Ryan Mallon <rmallon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Sascha Hauer <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Imre Kaloz <kaloz-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>,
	Krzysztof Halasa <khalasa-NlWvg49iv0c@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Alexander Clouter <alex-L4GPcECwBoDe9xe1eoZjHA@public.gmane.org>,
	Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Gregory CLEMENT
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Daniel Mack <daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>,
	Haojian Zhuang
	<haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>,
	Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Steven Miao <realmz6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>a
Subject: [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1)
Date: Tue,  1 Dec 2015 12:02:57 +0100	[thread overview]
Message-ID: <1448967802-25796-1-git-send-email-boris.brezillon@free-electrons.com> (raw)

Hello,

This huge series aims at clarifying the relationship between the mtd and
nand_chip structures and hiding NAND framework internals to NAND
controller drivers.

The first part of the series provide an mtd_to_nand() helper to hide the
way mtd and nand_chip are linked together.

The second part of the series embeds the mtd structure into the nand_chip
one so that NAND controller drivers don't have to bother allocating the
MTD device and linking it with the NAND chip.

The last part of the series hides accesses to the chip->priv field behind
two helper functions.

This allows removal of some of the boilerplate code done in all NAND
controller drivers, but most importantly, it unifies a bit the way NAND
chip structures are instantiated (even though we still have two different
kinds of drivers: those embedding the nand_chip struct into their private
nand chip representation, and those allocating two different structures
and linking them together with the chip->priv field).

As said in the title, this refactoring is only the first step. I plan to
rework the NAND controller / NAND chip separation for pretty much the same
reasons: clarifying the separation between the two concepts, and getting
rid of more boilerplate code in NAND controller drivers.

Stay tuned ;-).

Best Regards,

Boris

Changes since v1:
- dropped already applied patches
- fixed some typos
- manually fixed some modifications omitted by the coccinelle scripts
- manually reworked modifactions done by coccinelle scripts to improve
  readability and fix coding style issues

Boris Brezillon (25):
  ARM: nand: make use of mtd_to_nand() where appropriate
  blackfin: nand: make use of mtd_to_nand() where appropriate
  cris: nand: make use of mtd_to_nand() where appropriate
  mips: nand: make use of mtd_to_nand() where appropriate
  sh: nand: make use of mtd_to_nand() where appropriate
  mtd: nand: make use of mtd_to_nand() in NAND core code
  mtd: nand: make use of mtd_to_nand() in NAND drivers
  staging: mt29f_spinand: make use of mtd_to_nand()
  mtd: nand: embed an mtd_info structure into nand_chip
  mtd: nand: add nand_to_mtd() helper
  coccinelle: nand: detect and correct drivers embedding an mtd_info
    object
  mtd: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update the documentation to reflect framework changes
  staging: mt29f_spinand: use the mtd instance embedded in struct
    nand_chip
  cris: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update mtd_to_nand()
  mtd: nand: remove useless mtd->priv = chip assignments
  cris: nand: remove useless mtd->priv = chip assignments
  staging: mt29f_spinand: remove useless mtd->priv = chip assignment
  mtd: nand: simplify nand_dt_init() usage
  mtd: nand: kill the chip->flash_node field
  mtd: nand: add helpers to access ->priv
  ARM: make use of nand_set/get_controller_data() helpers
  mtd: nand: make use of nand_set/get_controller_data() helpers
  staging: mt29f_spinand: make use of nand_set/get_controller_data()
    helpers

 Documentation/DocBook/mtdnand.tmpl             |  31 +++---
 arch/arm/mach-ep93xx/snappercl15.c             |   4 +-
 arch/arm/mach-ep93xx/ts72xx.c                  |   4 +-
 arch/arm/mach-imx/mach-qong.c                  |   2 +-
 arch/arm/mach-ixp4xx/ixdp425-setup.c           |   6 +-
 arch/arm/mach-omap1/board-nand.c               |   2 +-
 arch/arm/mach-orion5x/ts78xx-setup.c           |   6 +-
 arch/arm/mach-pxa/balloon3.c                   |   2 +-
 arch/arm/mach-pxa/em-x270.c                    |   2 +-
 arch/arm/mach-pxa/palmtx.c                     |   2 +-
 arch/blackfin/mach-bf537/boards/stamp.c        |   2 +-
 arch/blackfin/mach-bf561/boards/acvilon.c      |   2 +-
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c |   8 +-
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c |   8 +-
 arch/mips/alchemy/devboards/db1200.c           |   2 +-
 arch/mips/alchemy/devboards/db1300.c           |   2 +-
 arch/mips/alchemy/devboards/db1550.c           |   2 +-
 arch/mips/pnx833x/common/platform.c            |   2 +-
 arch/mips/rb532/devices.c                      |   2 +-
 arch/sh/boards/mach-migor/setup.c              |   2 +-
 drivers/mtd/nand/ams-delta.c                   |  26 ++---
 drivers/mtd/nand/atmel_nand.c                  | 118 ++++++++++----------
 drivers/mtd/nand/au1550nd.c                    |  40 +++----
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |   1 -
 drivers/mtd/nand/bcm47xxnflash/main.c          |   9 +-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  34 +++---
 drivers/mtd/nand/bf5xx_nand.c                  |  25 ++---
 drivers/mtd/nand/brcmnand/brcmnand.c           |  54 +++++----
 drivers/mtd/nand/cafe_nand.c                   |  51 +++++----
 drivers/mtd/nand/cmx270_nand.c                 |  20 ++--
 drivers/mtd/nand/cs553x_nand.c                 |  30 +++--
 drivers/mtd/nand/davinci_nand.c                |  37 ++++---
 drivers/mtd/nand/denali.c                      |  67 ++++++-----
 drivers/mtd/nand/denali.h                      |   1 -
 drivers/mtd/nand/diskonchip.c                  | 148 ++++++++++++-------------
 drivers/mtd/nand/docg4.c                       |  91 ++++++++-------
 drivers/mtd/nand/fsl_elbc_nand.c               |  61 +++++-----
 drivers/mtd/nand/fsl_ifc_nand.c                |  71 ++++++------
 drivers/mtd/nand/fsl_upm.c                     |  31 +++---
 drivers/mtd/nand/fsmc_nand.c                   |  69 ++++++------
 drivers/mtd/nand/gpio.c                        |  19 ++--
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c          |   2 +-
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c         |  67 ++++++-----
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h         |   1 -
 drivers/mtd/nand/hisi504_nand.c                |  48 ++++----
 drivers/mtd/nand/jz4740_nand.c                 |  14 +--
 drivers/mtd/nand/lpc32xx_mlc.c                 |  32 +++---
 drivers/mtd/nand/lpc32xx_slc.c                 |  42 ++++---
 drivers/mtd/nand/mpc5121_nfc.c                 |  52 +++++----
 drivers/mtd/nand/mxc_nand.c                    |  76 +++++++------
 drivers/mtd/nand/nand_base.c                   | 102 +++++++++--------
 drivers/mtd/nand/nand_bbt.c                    |  32 +++---
 drivers/mtd/nand/nand_bch.c                    |   4 +-
 drivers/mtd/nand/nand_ecc.c                    |   4 +-
 drivers/mtd/nand/nandsim.c                     |  35 +++---
 drivers/mtd/nand/ndfc.c                        |  53 ++++-----
 drivers/mtd/nand/nuc900_nand.c                 |  25 ++---
 drivers/mtd/nand/omap2.c                       | 109 ++++++++++--------
 drivers/mtd/nand/orion_nand.c                  |  13 +--
 drivers/mtd/nand/pasemi_nand.c                 |  21 ++--
 drivers/mtd/nand/plat_nand.c                   |  16 +--
 drivers/mtd/nand/pxa3xx_nand.c                 |  70 ++++++------
 drivers/mtd/nand/r852.c                        |  41 +++----
 drivers/mtd/nand/r852.h                        |   1 -
 drivers/mtd/nand/s3c2410.c                     |  32 +++---
 drivers/mtd/nand/sh_flctl.c                    |   9 +-
 drivers/mtd/nand/sharpsl.c                     |  23 ++--
 drivers/mtd/nand/sm_common.c                   |   2 +-
 drivers/mtd/nand/socrates_nand.c               |  24 ++--
 drivers/mtd/nand/sunxi_nand.c                  |  40 ++++---
 drivers/mtd/nand/tmio_nand.c                   |  13 ++-
 drivers/mtd/nand/txx9ndfmc.c                   |  25 ++---
 drivers/mtd/nand/vf610_nfc.c                   |   9 +-
 drivers/mtd/nand/xway_nand.c                   |   4 +-
 drivers/staging/mt29f_spinand/mt29f_spinand.c  |  19 ++--
 include/linux/mtd/nand.h                       |  26 ++++-
 include/linux/mtd/sh_flctl.h                   |   3 +-
 scripts/coccinelle/api/nand-priv-no-mtd.cocci  |  91 +++++++++++++++
 78 files changed, 1179 insertions(+), 1097 deletions(-)
 create mode 100644 scripts/coccinelle/api/nand-priv-no-mtd.cocci

-- 
2.1.4

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1)
Date: Tue,  1 Dec 2015 12:02:57 +0100	[thread overview]
Message-ID: <1448967802-25796-1-git-send-email-boris.brezillon@free-electrons.com> (raw)

Hello,

This huge series aims at clarifying the relationship between the mtd and
nand_chip structures and hiding NAND framework internals to NAND
controller drivers.

The first part of the series provide an mtd_to_nand() helper to hide the
way mtd and nand_chip are linked together.

The second part of the series embeds the mtd structure into the nand_chip
one so that NAND controller drivers don't have to bother allocating the
MTD device and linking it with the NAND chip.

The last part of the series hides accesses to the chip->priv field behind
two helper functions.

This allows removal of some of the boilerplate code done in all NAND
controller drivers, but most importantly, it unifies a bit the way NAND
chip structures are instantiated (even though we still have two different
kinds of drivers: those embedding the nand_chip struct into their private
nand chip representation, and those allocating two different structures
and linking them together with the chip->priv field).

As said in the title, this refactoring is only the first step. I plan to
rework the NAND controller / NAND chip separation for pretty much the same
reasons: clarifying the separation between the two concepts, and getting
rid of more boilerplate code in NAND controller drivers.

Stay tuned ;-).

Best Regards,

Boris

Changes since v1:
- dropped already applied patches
- fixed some typos
- manually fixed some modifications omitted by the coccinelle scripts
- manually reworked modifactions done by coccinelle scripts to improve
  readability and fix coding style issues

Boris Brezillon (25):
  ARM: nand: make use of mtd_to_nand() where appropriate
  blackfin: nand: make use of mtd_to_nand() where appropriate
  cris: nand: make use of mtd_to_nand() where appropriate
  mips: nand: make use of mtd_to_nand() where appropriate
  sh: nand: make use of mtd_to_nand() where appropriate
  mtd: nand: make use of mtd_to_nand() in NAND core code
  mtd: nand: make use of mtd_to_nand() in NAND drivers
  staging: mt29f_spinand: make use of mtd_to_nand()
  mtd: nand: embed an mtd_info structure into nand_chip
  mtd: nand: add nand_to_mtd() helper
  coccinelle: nand: detect and correct drivers embedding an mtd_info
    object
  mtd: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update the documentation to reflect framework changes
  staging: mt29f_spinand: use the mtd instance embedded in struct
    nand_chip
  cris: nand: use the mtd instance embedded in struct nand_chip
  mtd: nand: update mtd_to_nand()
  mtd: nand: remove useless mtd->priv = chip assignments
  cris: nand: remove useless mtd->priv = chip assignments
  staging: mt29f_spinand: remove useless mtd->priv = chip assignment
  mtd: nand: simplify nand_dt_init() usage
  mtd: nand: kill the chip->flash_node field
  mtd: nand: add helpers to access ->priv
  ARM: make use of nand_set/get_controller_data() helpers
  mtd: nand: make use of nand_set/get_controller_data() helpers
  staging: mt29f_spinand: make use of nand_set/get_controller_data()
    helpers

 Documentation/DocBook/mtdnand.tmpl             |  31 +++---
 arch/arm/mach-ep93xx/snappercl15.c             |   4 +-
 arch/arm/mach-ep93xx/ts72xx.c                  |   4 +-
 arch/arm/mach-imx/mach-qong.c                  |   2 +-
 arch/arm/mach-ixp4xx/ixdp425-setup.c           |   6 +-
 arch/arm/mach-omap1/board-nand.c               |   2 +-
 arch/arm/mach-orion5x/ts78xx-setup.c           |   6 +-
 arch/arm/mach-pxa/balloon3.c                   |   2 +-
 arch/arm/mach-pxa/em-x270.c                    |   2 +-
 arch/arm/mach-pxa/palmtx.c                     |   2 +-
 arch/blackfin/mach-bf537/boards/stamp.c        |   2 +-
 arch/blackfin/mach-bf561/boards/acvilon.c      |   2 +-
 arch/cris/arch-v32/drivers/mach-a3/nandflash.c |   8 +-
 arch/cris/arch-v32/drivers/mach-fs/nandflash.c |   8 +-
 arch/mips/alchemy/devboards/db1200.c           |   2 +-
 arch/mips/alchemy/devboards/db1300.c           |   2 +-
 arch/mips/alchemy/devboards/db1550.c           |   2 +-
 arch/mips/pnx833x/common/platform.c            |   2 +-
 arch/mips/rb532/devices.c                      |   2 +-
 arch/sh/boards/mach-migor/setup.c              |   2 +-
 drivers/mtd/nand/ams-delta.c                   |  26 ++---
 drivers/mtd/nand/atmel_nand.c                  | 118 ++++++++++----------
 drivers/mtd/nand/au1550nd.c                    |  40 +++----
 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |   1 -
 drivers/mtd/nand/bcm47xxnflash/main.c          |   9 +-
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  34 +++---
 drivers/mtd/nand/bf5xx_nand.c                  |  25 ++---
 drivers/mtd/nand/brcmnand/brcmnand.c           |  54 +++++----
 drivers/mtd/nand/cafe_nand.c                   |  51 +++++----
 drivers/mtd/nand/cmx270_nand.c                 |  20 ++--
 drivers/mtd/nand/cs553x_nand.c                 |  30 +++--
 drivers/mtd/nand/davinci_nand.c                |  37 ++++---
 drivers/mtd/nand/denali.c                      |  67 ++++++-----
 drivers/mtd/nand/denali.h                      |   1 -
 drivers/mtd/nand/diskonchip.c                  | 148 ++++++++++++-------------
 drivers/mtd/nand/docg4.c                       |  91 ++++++++-------
 drivers/mtd/nand/fsl_elbc_nand.c               |  61 +++++-----
 drivers/mtd/nand/fsl_ifc_nand.c                |  71 ++++++------
 drivers/mtd/nand/fsl_upm.c                     |  31 +++---
 drivers/mtd/nand/fsmc_nand.c                   |  69 ++++++------
 drivers/mtd/nand/gpio.c                        |  19 ++--
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c          |   2 +-
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c         |  67 ++++++-----
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h         |   1 -
 drivers/mtd/nand/hisi504_nand.c                |  48 ++++----
 drivers/mtd/nand/jz4740_nand.c                 |  14 +--
 drivers/mtd/nand/lpc32xx_mlc.c                 |  32 +++---
 drivers/mtd/nand/lpc32xx_slc.c                 |  42 ++++---
 drivers/mtd/nand/mpc5121_nfc.c                 |  52 +++++----
 drivers/mtd/nand/mxc_nand.c                    |  76 +++++++------
 drivers/mtd/nand/nand_base.c                   | 102 +++++++++--------
 drivers/mtd/nand/nand_bbt.c                    |  32 +++---
 drivers/mtd/nand/nand_bch.c                    |   4 +-
 drivers/mtd/nand/nand_ecc.c                    |   4 +-
 drivers/mtd/nand/nandsim.c                     |  35 +++---
 drivers/mtd/nand/ndfc.c                        |  53 ++++-----
 drivers/mtd/nand/nuc900_nand.c                 |  25 ++---
 drivers/mtd/nand/omap2.c                       | 109 ++++++++++--------
 drivers/mtd/nand/orion_nand.c                  |  13 +--
 drivers/mtd/nand/pasemi_nand.c                 |  21 ++--
 drivers/mtd/nand/plat_nand.c                   |  16 +--
 drivers/mtd/nand/pxa3xx_nand.c                 |  70 ++++++------
 drivers/mtd/nand/r852.c                        |  41 +++----
 drivers/mtd/nand/r852.h                        |   1 -
 drivers/mtd/nand/s3c2410.c                     |  32 +++---
 drivers/mtd/nand/sh_flctl.c                    |   9 +-
 drivers/mtd/nand/sharpsl.c                     |  23 ++--
 drivers/mtd/nand/sm_common.c                   |   2 +-
 drivers/mtd/nand/socrates_nand.c               |  24 ++--
 drivers/mtd/nand/sunxi_nand.c                  |  40 ++++---
 drivers/mtd/nand/tmio_nand.c                   |  13 ++-
 drivers/mtd/nand/txx9ndfmc.c                   |  25 ++---
 drivers/mtd/nand/vf610_nfc.c                   |   9 +-
 drivers/mtd/nand/xway_nand.c                   |   4 +-
 drivers/staging/mt29f_spinand/mt29f_spinand.c  |  19 ++--
 include/linux/mtd/nand.h                       |  26 ++++-
 include/linux/mtd/sh_flctl.h                   |   3 +-
 scripts/coccinelle/api/nand-priv-no-mtd.cocci  |  91 +++++++++++++++
 78 files changed, 1179 insertions(+), 1097 deletions(-)
 create mode 100644 scripts/coccinelle/api/nand-priv-no-mtd.cocci

-- 
2.1.4

             reply	other threads:[~2015-12-01 11:03 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 11:02 Boris Brezillon [this message]
2015-12-01 11:02 ` [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1) Boris Brezillon
2015-12-01 11:02 ` Boris Brezillon
2015-12-01 11:02 ` [PATCH v2 01/25] ARM: nand: make use of mtd_to_nand() where appropriate Boris Brezillon
2015-12-01 11:02   ` Boris Brezillon
2015-12-01 11:02   ` Boris Brezillon
2015-12-01 11:02 ` [PATCH v2 02/25] blackfin: " Boris Brezillon
2015-12-01 11:02   ` Boris Brezillon
2015-12-01 11:02   ` Boris Brezillon
2015-12-08  3:20   ` Brian Norris
2015-12-01 11:03 ` [PATCH v2 03/25] cris: " Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-08  3:27   ` Brian Norris
2015-12-08  8:32     ` Jesper Nilsson
2015-12-01 11:03 ` [PATCH v2 04/25] mips: " Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-08  3:29   ` Brian Norris
2015-12-01 11:03 ` [PATCH v2 05/25] sh: " Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 06/25] mtd: nand: make use of mtd_to_nand() in NAND core code Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 07/25] mtd: nand: make use of mtd_to_nand() in NAND drivers Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 08/25] staging: mt29f_spinand: make use of mtd_to_nand() Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 09/25] mtd: nand: embed an mtd_info structure into nand_chip Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 10/25] mtd: nand: add nand_to_mtd() helper Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 11/25] coccinelle: nand: detect and correct drivers embedding an mtd_info object Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:17   ` Julia Lawall
2015-12-01 11:17     ` Julia Lawall
2015-12-01 11:17     ` Julia Lawall
2015-12-01 12:27     ` Boris Brezillon
2015-12-01 12:27       ` Boris Brezillon
2015-12-01 12:27       ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 12:28   ` kbuild test robot
2015-12-01 12:28     ` kbuild test robot
2015-12-01 12:28     ` kbuild test robot
2015-12-01 22:15   ` Brian Norris
2015-12-01 22:15     ` Brian Norris
2015-12-01 22:15     ` Brian Norris
2015-12-01 22:21   ` Brian Norris
2015-12-01 22:21     ` Brian Norris
2015-12-01 22:21     ` Brian Norris
2015-12-01 11:03 ` [PATCH v2 13/25] mtd: nand: update the documentation to reflect framework changes Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 14/25] staging: mt29f_spinand: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 15/25] cris: nand: " Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-08  8:35   ` Jesper Nilsson
2015-12-08  8:35     ` Jesper Nilsson
2015-12-08  8:35     ` Jesper Nilsson
2015-12-01 11:03 ` [PATCH v2 16/25] mtd: nand: update mtd_to_nand() Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 17/25] mtd: nand: remove useless mtd->priv = chip assignments Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 22:17   ` Brian Norris
2015-12-01 22:17     ` Brian Norris
2015-12-01 22:17     ` Brian Norris
2015-12-02  8:53     ` Boris Brezillon
2015-12-02  8:53       ` Boris Brezillon
2015-12-02  8:53       ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 18/25] cris: " Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-08  8:32   ` Jesper Nilsson
2015-12-08  8:32     ` Jesper Nilsson
2015-12-08  8:32     ` Jesper Nilsson
2015-12-01 11:03 ` [PATCH v2 19/25] staging: mt29f_spinand: remove useless mtd->priv = chip assignment Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 20/25] mtd: nand: simplify nand_dt_init() usage Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 21/25] mtd: nand: kill the chip->flash_node field Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 22/25] mtd: nand: add helpers to access ->priv Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 23/25] ARM: make use of nand_set/get_controller_data() helpers Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 24/25] mtd: nand: " Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03 ` [PATCH v2 25/25] staging: mt29f_spinand: " Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 11:03   ` Boris Brezillon
2015-12-01 13:03 ` [PATCH v3 12/25] mtd: nand: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-01 13:03   ` Boris Brezillon
2015-12-01 13:03   ` Boris Brezillon
2015-12-02  8:50 ` [PATCH v3 bis " Boris Brezillon
2015-12-02  8:50   ` Boris Brezillon
2015-12-02  8:50   ` Boris Brezillon
2015-12-09  0:17   ` Brian Norris
2015-12-09  0:17     ` Brian Norris
2015-12-09  0:17     ` Brian Norris
2015-12-09  8:32     ` Boris Brezillon
2015-12-09  8:32       ` Boris Brezillon
2015-12-09  8:32       ` Boris Brezillon
2015-12-02  8:51 ` [PATCH v3 17/25] mtd: nand: remove useless mtd->priv = chip assignments Boris Brezillon
2015-12-02  8:51   ` Boris Brezillon
2015-12-02  8:51   ` Boris Brezillon
2015-12-09  0:36 ` [PATCH v2 00/25] mtd: nand: refactor the NAND subsystem (part 1) Brian Norris
2015-12-09  0:36   ` Brian Norris
2015-12-09  0:36   ` Brian Norris
2015-12-09  8:15   ` Boris Brezillon
2015-12-09  8:15     ` Boris Brezillon
2015-12-09  8:15     ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448967802-25796-1-git-send-email-boris.brezillon@free-electrons.com \
    --to=boris.brezillon@free-electrons.com \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=alex@digriz.org.uk \
    --cc=andrew@lunn.ch \
    --cc=computersforpeace@gmail.com \
    --cc=corbet@lwn.net \
    --cc=daniel@zonque.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=dwmw2@infradead.org \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=hsweeten@visionengravers.com \
    --cc=jason@lakedaemon.net \
    --cc=jesper.nilsson@axis.com \
    --cc=josh.wu@atmel.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kaloz@openwrt.org \
    --cc=kernel@pengutronix.de \
    --cc=kgene@kernel.org \
    --cc=khalasa@piap.pl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-cris-kernel@axis.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=marek.vasut@gmail.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=maximlevitsky@gmail.com \
    --cc=mcuos.com@gmail.com \
    --cc=realmz6@gmail.com \
    --cc=rmallon@gmail.com \
    --cc=robert.jarzmik@free.fr \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=shawnguo@kernel.org \
    --cc=starvik@axis.com \
    --cc=stefan@agner.ch \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=tony@atomide.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.