From: Han Xu <han.xu@nxp.com>
To: "cyrille.pitchen@wedev4u.fr" <cyrille.pitchen@wedev4u.fr>,
"marek.vasut@gmail.com" <marek.vasut@gmail.com>
Cc: "boris.brezillon@free-electrons.com"
<boris.brezillon@free-electrons.com>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"kdasu.kdev@gmail.com" <kdasu.kdev@gmail.com>,
"richard@nod.at" <richard@nod.at>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
dl-linux-imx <linux-imx@nxp.com>,
"computersforpeace@gmail.com" <computersforpeace@gmail.com>
Subject: [PATCH] mtd: spi-nor: Add prep/unprep for spi_nor_resume
Date: Wed, 24 Apr 2019 21:08:33 +0000 [thread overview]
Message-ID: <20190424210818.25205-1-han.xu@nxp.com> (raw)
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@nxp.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
next reply other threads:[~2019-04-24 21:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 21:08 Han Xu [this message]
2019-06-06 5:45 ` [PATCH] mtd: spi-nor: Add prep/unprep for spi_nor_resume Tudor.Ambarus
2019-06-06 22:33 ` [EXT] " Han Xu
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=20190424210818.25205-1-han.xu@nxp.com \
--to=han.xu@nxp.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=f.fainelli@gmail.com \
--cc=kdasu.kdev@gmail.com \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/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;
as well as URLs for NNTP newsgroup(s).