From: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
To: linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
vinholikatti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: wsd_upstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
kuohong.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
avri.altman-Sjgp3cTcYWE@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
peter.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Subject: [PATCH v1 1/1] scsi: ufs: Print uic error history in time order
Date: Mon, 28 Jan 2019 22:04:26 +0800 [thread overview]
Message-ID: <1548684266-8792-1-git-send-email-stanley.chu@mediatek.com> (raw)
Now uic errors are printed out of time order.
Simply make it more readable by printing logs
in time order, and printing "No record" if history
is empty.
Signed-off-by: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
drivers/scsi/ufs/ufshcd.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9ba7671b84f8..f90badcb8318 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -393,15 +393,20 @@ static void ufshcd_print_uic_err_hist(struct ufs_hba *hba,
struct ufs_uic_err_reg_hist *err_hist, char *err_name)
{
int i;
+ bool found = false;
for (i = 0; i < UIC_ERR_REG_HIST_LENGTH; i++) {
- int p = (i + err_hist->pos - 1) % UIC_ERR_REG_HIST_LENGTH;
+ int p = (i + err_hist->pos) % UIC_ERR_REG_HIST_LENGTH;
if (err_hist->reg[p] == 0)
continue;
dev_err(hba->dev, "%s[%d] = 0x%x at %lld us\n", err_name, i,
err_hist->reg[p], ktime_to_us(err_hist->tstamp[p]));
+ found = true;
}
+
+ if (!found)
+ dev_err(hba->dev, "No record of %s uic errors\n", err_name);
}
static void ufshcd_print_host_regs(struct ufs_hba *hba)
--
2.18.0
next reply other threads:[~2019-01-28 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 14:04 Stanley Chu [this message]
[not found] ` <1548684266-8792-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-01-29 7:28 ` [PATCH v1 1/1] scsi: ufs: Print uic error history in time order Avri Altman
2019-02-05 3:04 ` Martin K. Petersen
-- strict thread matches above, loose matches on Subject: below --
2019-01-30 10:19 Bean Huo (beanhuo)
[not found] ` <BYAPR08MB4533E3AEBFF64A2ABB33EB45DB900-73df4QikVELese8zA3WVkpNArRD3w/9+vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-02-03 23:34 ` Stanley Chu
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=1548684266-8792-1-git-send-email-stanley.chu@mediatek.com \
--to=stanley.chu-nus5lvnupcjwk0htik3j/w@public.gmane.org \
--cc=avri.altman-Sjgp3cTcYWE@public.gmane.org \
--cc=kuohong.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=peter.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=vinholikatti-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wsd_upstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.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