public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
	"Joachim Eastwood" <manabian@gmail.com>,
	"Ezequiel Garcia" <ezequiel@vanguardiasur.com.ar>,
	"Marek Vasut" <marex@denx.de>, "Han Xu" <han.xu@freescale.com>,
	"Brian Norris" <computersforpeace@gmail.com>
Subject: [RFT PATCH 2/4] mtd: spi-nor: assign mtd->priv in spi_nor_scan()
Date: Thu, 13 Aug 2015 15:46:03 -0700	[thread overview]
Message-ID: <1439505965-134748-3-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1439505965-134748-1-git-send-email-computersforpeace@gmail.com>

Layering suggests that the SPI NOR layer (not the hardware driver)
should be initializing the MTD layer.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/devices/m25p80.c      | 1 -
 drivers/mtd/spi-nor/fsl-quadspi.c | 1 -
 drivers/mtd/spi-nor/nxp-spifi.c   | 1 -
 drivers/mtd/spi-nor/spi-nor.c     | 1 +
 4 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 9cd3631170ef..24965ae9f7aa 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -205,7 +205,6 @@ static int m25p_probe(struct spi_device *spi)
 	nor->priv = flash;
 
 	spi_set_drvdata(spi, flash);
-	flash->mtd.priv = nor;
 	flash->spi = spi;
 
 	if (spi->mode & SPI_RX_QUAD)
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 2a17ec6269ff..cefc9636e551 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -1016,7 +1016,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 		nor->mtd = mtd;
 		nor->dev = dev;
 		nor->priv = q;
-		mtd->priv = nor;
 
 		/* fill the hooks */
 		nor->read_reg = fsl_qspi_read_reg;
diff --git a/drivers/mtd/spi-nor/nxp-spifi.c b/drivers/mtd/spi-nor/nxp-spifi.c
index 9ad1dd0896c0..ce6a478a02a5 100644
--- a/drivers/mtd/spi-nor/nxp-spifi.c
+++ b/drivers/mtd/spi-nor/nxp-spifi.c
@@ -331,7 +331,6 @@ static int nxp_spifi_setup_flash(struct nxp_spifi *spifi,
 
 	writel(ctrl, spifi->io_base + SPIFI_CTRL);
 
-	spifi->mtd.priv  = &spifi->nor;
 	spifi->nor.mtd   = &spifi->mtd;
 	spifi->nor.dev   = spifi->dev;
 	spifi->nor.priv  = spifi;
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 47516d3af015..cba513373d5e 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1066,6 +1066,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
 
 	if (!mtd->name)
 		mtd->name = dev_name(dev);
+	mtd->priv = nor;
 	mtd->type = MTD_NORFLASH;
 	mtd->writesize = 1;
 	mtd->flags = MTD_CAP_NORFLASH;
-- 
2.5.0.276.gf5e568e

  parent reply	other threads:[~2015-08-13 22:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 22:46 [RFT PATCH 0/4] mtd: spi-nor: code refactoring and layering Brian Norris
2015-08-13 22:46 ` [RFT PATCH 1/4] mtd: fsl-quadspi: use automatic spi-nor detection Brian Norris
2015-08-13 23:09   ` Marek Vasut
2015-08-13 23:24     ` Brian Norris
2015-08-13 23:54       ` Marek Vasut
2015-08-14  5:40       ` Michal Suchanek
2015-08-18  2:56         ` Brian Norris
2015-08-18  3:15           ` Han Xu
2015-08-18  8:09             ` Huang Shijie
2015-09-01 18:41               ` Brian Norris
2015-09-01 23:40   ` Han Xu
2015-09-01 23:54     ` Brian Norris
2015-08-13 22:46 ` Brian Norris [this message]
2015-08-14 14:48   ` [RFT PATCH 2/4] mtd: spi-nor: assign mtd->priv in spi_nor_scan() Joachim Eastwood
2015-08-13 22:46 ` [RFT PATCH 3/4] mtd: spi-nor: add forward declaration for mtd_info Brian Norris
2015-08-14 14:49   ` Joachim Eastwood
2015-08-13 22:46 ` [RFT PATCH 4/4] mtd: spi-nor: embed struct mtd_info within struct spi_nor Brian Norris
2015-08-14 14:52   ` Joachim Eastwood

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=1439505965-134748-3-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=han.xu@freescale.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=manabian@gmail.com \
    --cc=marex@denx.de \
    --cc=zajec5@gmail.com \
    /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