linux-kernel.vger.kernel.org archive mirror
 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 v4 42/58] mtd: nand: sunxi: use the mtd instance embedded in struct nand_chip
Date: Thu, 10 Dec 2015 09:00:26 +0100	[thread overview]
Message-ID: <1449734442-18672-43-git-send-email-boris.brezillon@free-electrons.com> (raw)
In-Reply-To: <1449734442-18672-1-git-send-email-boris.brezillon@free-electrons.com>

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
Changes generated with the following coccinelle script

--->8---
virtual patch

@fix1@
identifier __chipfield, __mtdfield;
type __type;
@@
(
	__type {
		...
		struct nand_chip __chipfield;
		...
-		struct mtd_info __mtdfield;
		...
	};
|
	__type {
		...
-		struct mtd_info __mtdfield;
		...
		struct nand_chip __chipfield;
		...
	};
)

@fix2 depends on fix1@
identifier fix1.__chipfield, fix1.__mtdfield;
identifier __subfield;
type fix1.__type;
__type *__priv;
@@
(
-	__priv->__mtdfield.__subfield
+	nand_to_mtd(&__priv->__chipfield)->__subfield
|
-	&(__priv->__mtdfield)
+	nand_to_mtd(&__priv->__chipfield)
)
--->8---
---
 drivers/mtd/nand/sunxi_nand.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index 4ecd486..c29d659 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -234,7 +234,6 @@ struct sunxi_nand_hw_ecc {
 struct sunxi_nand_chip {
 	struct list_head node;
 	struct nand_chip nand;
-	struct mtd_info mtd;
 	unsigned long clk_rate;
 	u32 timing_cfg;
 	u32 timing_ctl;
@@ -991,6 +990,7 @@ static int sunxi_nand_chip_set_timings(struct sunxi_nand_chip *chip,
 static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
 					struct device_node *np)
 {
+	struct mtd_info *mtd = nand_to_mtd(&chip->nand);
 	const struct nand_sdr_timings *timings;
 	int ret;
 	int mode;
@@ -1008,12 +1008,11 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
 
 		feature[0] = mode;
 		for (i = 0; i < chip->nsels; i++) {
-			chip->nand.select_chip(&chip->mtd, i);
-			ret = chip->nand.onfi_set_features(&chip->mtd,
-						&chip->nand,
+			chip->nand.select_chip(mtd, i);
+			ret = chip->nand.onfi_set_features(mtd,	&chip->nand,
 						ONFI_FEATURE_ADDR_TIMING_MODE,
 						feature);
-			chip->nand.select_chip(&chip->mtd, -1);
+			chip->nand.select_chip(mtd, -1);
 			if (ret)
 				return ret;
 		}
@@ -1336,7 +1335,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
 	nand->write_buf = sunxi_nfc_write_buf;
 	nand->read_byte = sunxi_nfc_read_byte;
 
-	mtd = &chip->mtd;
+	mtd = nand_to_mtd(nand);
 	mtd->dev.parent = dev;
 	mtd->priv = nand;
 
@@ -1407,7 +1406,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
 	while (!list_empty(&nfc->chips)) {
 		chip = list_first_entry(&nfc->chips, struct sunxi_nand_chip,
 					node);
-		nand_release(&chip->mtd);
+		nand_release(nand_to_mtd(&chip->nand));
 		sunxi_nand_ecc_cleanup(&chip->nand.ecc);
 		list_del(&chip->node);
 	}
-- 
2.1.4


  parent reply	other threads:[~2015-12-10  8:08 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10  7:59 [PATCH v4 00/58] mtd: nand: refactor the NAND subsystem (part 1) Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 01/58] mtd: nand: denali: add missing nand_release() call in denali_remove() Boris Brezillon
2015-12-11  0:40   ` Brian Norris
2015-12-11 13:53     ` Boris Brezillon
2015-12-11 14:39       ` Dan Carpenter
2015-12-11 15:15         ` Boris Brezillon
2015-12-11 22:03     ` Boris Brezillon
2015-12-11 22:11       ` Brian Norris
2015-12-11 14:02   ` [PATCH v5 " Boris Brezillon
2015-12-11 15:10     ` Boris Brezillon
2015-12-11 16:50       ` Dinh Nguyen
2015-12-11 17:08         ` Boris Brezillon
2015-12-11 17:21           ` Dinh Nguyen
2015-12-10  7:59 ` [PATCH v4 02/58] mtd: nand: fsmc: create and use mtd_to_fsmc() Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 03/58] mtd: nand: nuc900: create and use mtd_to_nuc900() Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 04/58] mtd: nand: omap2: create and use mtd_to_omap() Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 05/58] mtd: nand: ams-delta: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 06/58] mtd: nand: atmel: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 07/58] mtd: nand: au1550nd: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 08/58] mtd: nand: bcm47xx: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 09/58] mtd: nand: bf5xx: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 10/58] mtd: nand: brcm: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 11/58] mtd: nand: cafe: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 12/58] mtd: nand: cmx270: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 13/58] mtd: nand: cs553x: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 14/58] mtd: nand: davinci: " Boris Brezillon
2015-12-10  7:59 ` [PATCH v4 15/58] mtd: nand: denali: " Boris Brezillon
2015-12-11 14:06   ` [PATCH v5 " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 16/58] mtd: nand: diskonchip: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 17/58] mtd: nand: docg4: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 18/58] mtd: nand: fsl_elbc: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 19/58] mtd: nand: fsl_ifc: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 20/58] mtd: nand: fsl_upm: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 21/58] mtd: nand: fsmc: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 22/58] mtd: nand: gpio: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 23/58] mtd: nand: gpmi: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 24/58] mtd: nand: hisi504: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 25/58] mtd: nand: jz4740: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 26/58] mtd: nand: lpc32xx: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 27/58] mtd: nand: mpc5121: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 28/58] mtd: nand: mxc: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 29/58] mtd: nand: nandsim: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 30/58] mtd: nand: ndfc: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 31/58] mtd: nand: nuc900: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 32/58] mtd: nand: omap2: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 33/58] mtd: nand: orion: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 34/58] mtd: nand: pasemi: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 35/58] mtd: nand: plat: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 36/58] mtd: nand: pxa3xx: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 37/58] mtd: nand: r852: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 38/58] mtd: nand: s3c2410: " Boris Brezillon
2015-12-11  2:38   ` Krzysztof Kozlowski
2015-12-10  8:00 ` [PATCH v4 39/58] mtd: nand: sh_flctl: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 40/58] mtd: nand: sharpsl: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 41/58] mtd: nand: socrates: " Boris Brezillon
2015-12-11 14:04   ` [PATCH v5 " Boris Brezillon
2015-12-10  8:00 ` Boris Brezillon [this message]
2015-12-10  8:00 ` [PATCH v4 43/58] mtd: nand: tmio: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 44/58] mtd: nand: txx9ndfmc: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 45/58] mtd: nand: vf610: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 46/58] mtd: nand: update the documentation to reflect framework changes Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 47/58] staging: mt29f_spinand: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 48/58] cris: nand: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 49/58] mtd: nand: update mtd_to_nand() Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 50/58] mtd: nand: remove useless mtd->priv = chip assignments Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 51/58] cris: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 52/58] staging: mt29f_spinand: remove useless mtd->priv = chip assignment Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 53/58] mtd: nand: simplify nand_dt_init() usage Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 54/58] mtd: nand: kill the chip->flash_node field Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 55/58] mtd: nand: add helpers to access ->priv Boris Brezillon
2015-12-18 22:17   ` Brian Norris
2015-12-19  3:01     ` Boris Brezillon
2016-01-06 23:13       ` Brian Norris
2016-01-07 14:52         ` Boris Brezillon
2016-01-07 17:17           ` Brian Norris
2015-12-10  8:00 ` [PATCH v4 56/58] ARM: make use of nand_set/get_controller_data() helpers Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 57/58] mtd: nand: " Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 58/58] staging: mt29f_spinand: " Boris Brezillon
2015-12-18 22:03 ` [PATCH v4 00/58] mtd: nand: refactor the NAND subsystem (part 1) Brian Norris

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=1449734442-18672-43-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 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).