提交 848fd6b1 编写于 作者: C Chaotian Jing 提交者: Greg Kroah-Hartman

mmc: block: Make card_busy_detect() a bit more generic

commit 3869468e0c4800af52bfe1e0b72b338dcdae2cfc upstream.

To prepare for more users of card_busy_detect(), let's drop the struct
request * as an in-parameter and convert to log the error message via
dev_err() instead of pr_err().
Signed-off-by: NChaotian Jing <chaotian.jing@mediatek.com>
Reviewed-by: NAvri Altman <avri.altman@wdc.com>
Cc: stable@vger.kernel.org
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 45ede4b1
...@@ -982,7 +982,7 @@ static inline bool mmc_blk_in_tran_state(u32 status) ...@@ -982,7 +982,7 @@ static inline bool mmc_blk_in_tran_state(u32 status)
} }
static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
struct request *req, u32 *resp_errs) u32 *resp_errs)
{ {
unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
int err = 0; int err = 0;
...@@ -993,8 +993,8 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, ...@@ -993,8 +993,8 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
err = __mmc_send_status(card, &status, 5); err = __mmc_send_status(card, &status, 5);
if (err) { if (err) {
pr_err("%s: error %d requesting status\n", dev_err(mmc_dev(card->host),
req->rq_disk->disk_name, err); "error %d requesting status\n", err);
return err; return err;
} }
...@@ -1007,9 +1007,9 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, ...@@ -1007,9 +1007,9 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
* leaves the program state. * leaves the program state.
*/ */
if (done) { if (done) {
pr_err("%s: Card stuck in wrong state! %s %s status: %#x\n", dev_err(mmc_dev(card->host),
mmc_hostname(card->host), "Card stuck in wrong state! %s status: %#x\n",
req->rq_disk->disk_name, __func__, status); __func__, status);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -1678,7 +1678,7 @@ static int mmc_blk_fix_state(struct mmc_card *card, struct request *req) ...@@ -1678,7 +1678,7 @@ static int mmc_blk_fix_state(struct mmc_card *card, struct request *req)
mmc_blk_send_stop(card, timeout); mmc_blk_send_stop(card, timeout);
err = card_busy_detect(card, timeout, req, NULL); err = card_busy_detect(card, timeout, NULL);
mmc_retune_release(card->host); mmc_retune_release(card->host);
...@@ -1902,7 +1902,7 @@ static int mmc_blk_card_busy(struct mmc_card *card, struct request *req) ...@@ -1902,7 +1902,7 @@ static int mmc_blk_card_busy(struct mmc_card *card, struct request *req)
if (mmc_host_is_spi(card->host) || rq_data_dir(req) == READ) if (mmc_host_is_spi(card->host) || rq_data_dir(req) == READ)
return 0; return 0;
err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, req, &status); err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, &status);
/* /*
* Do not assume data transferred correctly if there are any error bits * Do not assume data transferred correctly if there are any error bits
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册