From: Barry Song <Barry.Song@csr.com>
To: chris@printf.net, ulf.hansson@linaro.org
Cc: Barry Song <Baohua.Song@csr.com>,
linux-mmc@vger.kernel.org, workgroup.linux@csr.com,
linux-arm-kernel@lists.infradead.org,
Minda Chen <Minda.Chen@csr.com>
Subject: [PATCH] mmc: core: sd: check card write-protect lock while resuming
Date: Mon, 18 Aug 2014 18:00:12 +0800 [thread overview]
Message-ID: <1408356012-18867-1-git-send-email-Barry.Song@csr.com> (raw)
From: Minda Chen <Minda.Chen@csr.com>
After suspending, unplug the sdcard, and set sd WP lock,
insert it again, then resume the system. resume codes do
not check the the sdcard write-proctect lock. now check
it.
Signed-off-by: Minda Chen <Minda.Chen@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
drivers/mmc/core/sd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 0c44510..890557a 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -910,6 +910,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
int err;
u32 cid[4];
u32 rocr = 0;
+ bool oldro, ro;
BUG_ON(!host);
WARN_ON(!host->claimed);
@@ -922,6 +923,12 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0)
return -ENOENT;
+ if (host->ops->get_ro) {
+ ro = host->ops->get_ro(host) ? true : false;
+ oldro = mmc_card_readonly(oldcard) ? true : false;
+ if (oldro ^ ro)
+ return -ENOENT;
+ }
card = oldcard;
} else {
/*
--
2.0.4
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.
next reply other threads:[~2014-08-18 10:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 10:00 Barry Song [this message]
2014-08-18 11:57 ` [PATCH] mmc: core: sd: check card write-protect lock while resuming Ulf Hansson
2014-08-22 6:55 ` Barry Song
2014-08-22 10:00 ` Ulf Hansson
[not found] ` <7960C73727803F45B9F4D2B2441DA8AC0CE80220@SHAASIEXM01.ASIA.ROOT.PRI>
2014-08-28 2:02 ` FW: " minda chen
2014-08-28 6:25 ` Ulf Hansson
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=1408356012-18867-1-git-send-email-Barry.Song@csr.com \
--to=barry.song@csr.com \
--cc=Baohua.Song@csr.com \
--cc=Minda.Chen@csr.com \
--cc=chris@printf.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=workgroup.linux@csr.com \
/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