Skip to content

Commit

Permalink
mmc: block: Make card_busy_detect() a bit more generic
Browse files Browse the repository at this point in the history
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: Chaotian Jing <chaotian.jing@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Chaotian Jing authored and Ulf Hansson committed Nov 13, 2019
1 parent 22dc132 commit 3869468
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/mmc/core/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ static inline bool mmc_blk_in_tran_state(u32 status)
}

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);
int err = 0;
Expand All @@ -992,8 +992,8 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,

err = __mmc_send_status(card, &status, 5);
if (err) {
pr_err("%s: error %d requesting status\n",
req->rq_disk->disk_name, err);
dev_err(mmc_dev(card->host),
"error %d requesting status\n", err);
return err;
}

Expand All @@ -1006,9 +1006,9 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
* leaves the program state.
*/
if (done) {
pr_err("%s: Card stuck in wrong state! %s %s status: %#x\n",
mmc_hostname(card->host),
req->rq_disk->disk_name, __func__, status);
dev_err(mmc_dev(card->host),
"Card stuck in wrong state! %s status: %#x\n",
__func__, status);
return -ETIMEDOUT;
}

Expand Down Expand Up @@ -1671,7 +1671,7 @@ static int mmc_blk_fix_state(struct mmc_card *card, struct request *req)

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);

Expand Down Expand Up @@ -1895,7 +1895,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)
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
Expand Down

0 comments on commit 3869468

Please sign in to comment.