mtd: spi-nor: assign mtd->priv in spi_nor_scan()
authorBrian Norris <computersforpeace@gmail.com>
Thu, 13 Aug 2015 22:46:03 +0000 (15:46 -0700)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 2 Sep 2015 21:11:40 +0000 (14:11 -0700)
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>
drivers/mtd/devices/m25p80.c
drivers/mtd/spi-nor/fsl-quadspi.c
drivers/mtd/spi-nor/nxp-spifi.c
drivers/mtd/spi-nor/spi-nor.c

index 9cd3631170ef8689f4b9851fa2993c863dfcd9e9..24965ae9f7aade50d305dc697ca6112c2fc92353 100644 (file)
@@ -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)
index d32b7e04cccab780fcee0b0a3d84319b083f713b..ad9f73ae6eea167975b6350bfc69c937dbb13eb1 100644 (file)
@@ -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;
index 9ad1dd0896c02344339a9456993cfee57a5236ce..ce6a478a02a5d9b1221cbf78418c7bdd69c39d7c 100644 (file)
@@ -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;
index 25372f9b534e811b53675deedcdee7990d2a0ce8..d98180e73307bb7ed4a87a48c63b36a7961492af 100644 (file)
@@ -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;