From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: "Pierre Ossman" <drzeus@drzeus.cx>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] mmc_block: print better data error message after timeout
Date: Thu, 16 Oct 2008 16:26:55 +0300 [thread overview]
Message-ID: <48F7411F.3020109@nokia.com> (raw)
In particular, if the card gets an ECC error it will
timeout, in which case it is much more helpful to see
an ECC error rather than a timeout error.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
drivers/mmc/card/block.c | 47 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 24c97d3..d121462 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -210,6 +210,47 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
return blocks;
}
+static void print_data_error(struct mmc_blk_request *brq, struct mmc_card *card,
+ struct request *req)
+{
+ struct mmc_command cmd;
+ char *emsg;
+ u32 status;
+ int status_err = 0;
+
+ if (brq->data.error != -ETIMEDOUT || mmc_host_is_spi(card->host))
+ goto out_print;
+
+ if (brq->mrq.stop)
+ /* 'Stop' response contains card status */
+ status = brq->mrq.stop->resp[0];
+ else {
+ cmd.opcode = MMC_SEND_STATUS;
+ cmd.arg = card->rca << 16;
+ cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+ status_err = mmc_wait_for_cmd(card->host, &cmd, 0);
+ if (status_err)
+ goto out_print;
+ status = cmd.resp[0];
+ }
+
+ emsg = (status & R1_CARD_ECC_FAILED) ? "ECC" : "I/O";
+
+ printk(KERN_ERR "%s: %s error transferring data, sector %u, "
+ "card status %#x\n", req->rq_disk->disk_name, emsg,
+ (unsigned)req->sector, status);
+
+ return;
+
+out_print:
+ printk(KERN_ERR "%s: error %d transferring data, sector %u, nr %u\n",
+ req->rq_disk->disk_name, brq->data.error, (unsigned)req->sector,
+ (unsigned)req->nr_sectors);
+ if (status_err)
+ printk(KERN_ERR "%s: error %d requesting card status\n",
+ req->rq_disk->disk_name, status_err);
+}
+
static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
{
struct mmc_blk_data *md = mq->data;
@@ -281,10 +322,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
req->rq_disk->disk_name, brq.cmd.error);
}
- if (brq.data.error) {
- printk(KERN_ERR "%s: error %d transferring data\n",
- req->rq_disk->disk_name, brq.data.error);
- }
+ if (brq.data.error)
+ print_data_error(&brq, card, req);
if (brq.stop.error) {
printk(KERN_ERR "%s: error %d sending stop command\n",
--
1.5.4.3
next reply other threads:[~2008-10-16 13:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-16 13:26 Adrian Hunter [this message]
2008-10-26 11:11 ` [PATCH 1/2] mmc_block: print better data error message after timeout Pierre Ossman
2008-10-27 15:33 ` Adrian Hunter
2008-10-29 10:29 ` Adrian Hunter
2008-11-10 8:20 ` Adrian Hunter
2008-11-10 9:53 ` Pierre Ossman
2008-11-30 18:48 ` Pierre Ossman
2008-12-04 13:35 ` Adrian Hunter
2008-12-21 14:22 ` Pierre Ossman
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=48F7411F.3020109@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--cc=drzeus@drzeus.cx \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).