MLK-21514: mtd: spi-nor: add prep/unprep for spi_nor_resume()
authorHan Xu <han.xu@nxp.com>
Wed, 24 Apr 2019 20:30:14 +0000 (15:30 -0500)
committerHan Xu <han.xu@nxp.com>
Wed, 24 Apr 2019 20:34:02 +0000 (15:34 -0500)
prep/unprep functions were not added in new spi_nor_resume function.

Signed-off-by: Han Xu <han.xu@nxp.com>
drivers/mtd/spi-nor/spi-nor.c
include/linux/mtd/spi-nor.h

index 922ffbf..f1ffe81 100644 (file)
@@ -2839,10 +2839,18 @@ static void spi_nor_resume(struct mtd_info *mtd)
        struct device *dev = nor->dev;
        int ret;
 
+       ret = spi_nor_lock_and_prep(nor, SPI_NOR_OPS_RESUME);
+       if (ret) {
+               dev_err(dev, "prepare() failed\n");
+               return;
+       }
+
        /* re-initialize the nor chip */
        ret = spi_nor_init(nor);
        if (ret)
                dev_err(dev, "resume() failed\n");
+
+       spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_RESUME);
 }
 
 void spi_nor_restore(struct spi_nor *nor)
index 8848638..3c0c791 100644 (file)
@@ -232,6 +232,7 @@ enum spi_nor_ops {
        SPI_NOR_OPS_ERASE,
        SPI_NOR_OPS_LOCK,
        SPI_NOR_OPS_UNLOCK,
+       SPI_NOR_OPS_RESUME,
 };
 
 enum spi_nor_option_flags {