[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190424210818.25205-1-han.xu@nxp.com>
Date: Wed, 24 Apr 2019 21:08:33 +0000
From: Han Xu <han.xu@....com>
To: "cyrille.pitchen@...ev4u.fr" <cyrille.pitchen@...ev4u.fr>,
"marek.vasut@...il.com" <marek.vasut@...il.com>
CC: "boris.brezillon@...e-electrons.com"
<boris.brezillon@...e-electrons.com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"kdasu.kdev@...il.com" <kdasu.kdev@...il.com>,
"richard@....at" <richard@....at>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
dl-linux-imx <linux-imx@....com>,
"computersforpeace@...il.com" <computersforpeace@...il.com>
Subject: [PATCH] mtd: spi-nor: Add prep/unprep for spi_nor_resume
In the new implemented spi_nor_resume function, the spi_nor_init()
should be braced by prep/unprep functions._
Signed-off-by: Han Xu <han.xu@....com>
---
drivers/mtd/spi-nor/spi-nor.c | 8 ++++++++
include/linux/mtd/spi-nor.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 73172d7f512b..f6491885fa4f 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -3956,10 +3956,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)
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index b3d360b0ee3d..50cf71dd7e9e 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -231,6 +231,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 {
--
2.17.1
Powered by blists - more mailing lists