From: Johan Rudholm <johan.rudholm@axis.com>
To: linux-mmc@vger.kernel.org, Chris Ball <chris@printf.net>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Adrian Hunter" <adrian.hunter@intel.com>,
"Guennadi Liakhovetski" <g.liakhovetski@gmx.de>,
"David Lanzendörfer" <david.lanzendoerfer@o2s.ch>,
"Jesper Nilsson" <jespern@axis.com>,
"Johan Rudholm" <johanru@axis.com>
Subject: [PATCH v7 1/3] mmc: core: always check status after reset
Date: Mon, 12 Jan 2015 15:38:04 +0100 [thread overview]
Message-ID: <1421073486-10903-2-git-send-email-johanru@axis.com> (raw)
In-Reply-To: <1421073486-10903-1-git-send-email-johanru@axis.com>
Always check if the card is alive after a successful reset. This allows
us to remove mmc_hw_reset_check(), leaving mmc_hw_reset() as the only
card reset interface.
Signed-off-by: Johan Rudholm <johanru@axis.com>
---
drivers/mmc/card/mmc_test.c | 18 +++++++-----------
drivers/mmc/core/core.c | 24 +++++-------------------
include/linux/mmc/core.h | 1 -
3 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 0a7430f..7dac469 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -2342,20 +2342,16 @@ static int mmc_test_hw_reset(struct mmc_test_card *test)
struct mmc_host *host = card->host;
int err;
- err = mmc_hw_reset_check(host);
+ if (!mmc_card_mmc(card) || !mmc_can_reset(card))
+ return RESULT_UNSUP_CARD;
+
+ err = mmc_hw_reset(host);
if (!err)
return RESULT_OK;
+ else if (err == -EOPNOTSUPP)
+ return RESULT_UNSUP_HOST;
- if (err == -ENOSYS)
- return RESULT_FAIL;
-
- if (err != -EOPNOTSUPP)
- return err;
-
- if (!mmc_can_reset(card))
- return RESULT_UNSUP_CARD;
-
- return RESULT_UNSUP_HOST;
+ return RESULT_FAIL;
}
static const struct mmc_test_case mmc_test_cases[] = {
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index d3bfbdf..9959997e 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2286,9 +2286,10 @@ int mmc_can_reset(struct mmc_card *card)
}
EXPORT_SYMBOL(mmc_can_reset);
-static int mmc_do_hw_reset(struct mmc_host *host, int check)
+static int mmc_hw_reset(struct mmc_host *host)
{
struct mmc_card *card = host->card;
+ u32 status;
if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
return -EOPNOTSUPP;
@@ -2305,13 +2306,9 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
host->ops->hw_reset(host);
/* If the reset has happened, then a status command will fail */
- if (check) {
- u32 status;
-
- if (!mmc_send_status(card, &status)) {
- mmc_host_clk_release(host);
- return -ENOSYS;
- }
+ if (!mmc_send_status(card, &status)) {
+ mmc_host_clk_release(host);
+ return -ENOSYS;
}
/* Set initial state and call mmc_set_ios */
@@ -2321,19 +2318,8 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
return host->bus_ops->power_restore(host);
}
-
-int mmc_hw_reset(struct mmc_host *host)
-{
- return mmc_do_hw_reset(host, 0);
-}
EXPORT_SYMBOL(mmc_hw_reset);
-int mmc_hw_reset_check(struct mmc_host *host)
-{
- return mmc_do_hw_reset(host, 1);
-}
-EXPORT_SYMBOL(mmc_hw_reset_check);
-
static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
{
host->f_init = freq;
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index cb2b040..160448f 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -182,7 +182,6 @@ extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
extern int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount,
bool is_rel_write);
extern int mmc_hw_reset(struct mmc_host *host);
-extern int mmc_hw_reset_check(struct mmc_host *host);
extern int mmc_can_reset(struct mmc_card *card);
extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
--
1.7.2.5
next prev parent reply other threads:[~2015-01-12 14:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 14:38 [PATCH v7 0/3] mmc: core: hw_reset changes Johan Rudholm
2015-01-12 14:38 ` Johan Rudholm [this message]
2015-01-12 14:38 ` [PATCH v7 2/3] mmc: core: refactor the hw_reset routines Johan Rudholm
2015-01-12 14:38 ` [PATCH v7 3/3] mmc: sd: add reset bus_ops callback Johan Rudholm
2015-01-12 15:11 ` [PATCH v7 0/3] mmc: core: hw_reset changes Ulf Hansson
2015-01-13 8:19 ` Ulf Hansson
2015-01-13 8:26 ` Johan Rudholm
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=1421073486-10903-2-git-send-email-johanru@axis.com \
--to=johan.rudholm@axis.com \
--cc=adrian.hunter@intel.com \
--cc=chris@printf.net \
--cc=david.lanzendoerfer@o2s.ch \
--cc=g.liakhovetski@gmx.de \
--cc=jespern@axis.com \
--cc=johanru@axis.com \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/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