summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-08-13 15:46:03 -0700
committerBrian Norris <computersforpeace@gmail.com>2015-09-02 14:11:40 -0700
commitc9ec3900abf279d9276a0661c9bed2550c1f0bb5 (patch)
treeac20ee2bf17cad50e073941ebe46e7f3ca3a0971 /drivers
parent0f12a27b47284e86eaa4a5ad3877ec3018463178 (diff)
downloadlinux-c9ec3900abf279d9276a0661c9bed2550c1f0bb5.tar.gz
linux-c9ec3900abf279d9276a0661c9bed2550c1f0bb5.tar.bz2
linux-c9ec3900abf279d9276a0661c9bed2550c1f0bb5.zip
mtd: spi-nor: assign mtd->priv in spi_nor_scan()
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> Tested-by: Joachim Eastwood <manabian@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/devices/m25p80.c1
-rw-r--r--drivers/mtd/spi-nor/fsl-quadspi.c1
-rw-r--r--drivers/mtd/spi-nor/nxp-spifi.c1
-rw-r--r--drivers/mtd/spi-nor/spi-nor.c1
4 files changed, 1 insertions, 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 d32b7e04ccca..ad9f73ae6eea 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -1018,7 +1018,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 25372f9b534e..d98180e73307 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1061,6 +1061,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;