linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] scsi: ufs: Print uic error history in time order
@ 2019-01-28 14:04 Stanley Chu
       [not found] ` <1548684266-8792-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Stanley Chu @ 2019-01-28 14:04 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	vinholikatti-Re5JQEeQqe8AvxtiuMwx3w
  Cc: wsd_upstream-NuS5LvNUpcJWk0Htik3J/w,
	kuohong.wang-NuS5LvNUpcJWk0Htik3J/w, avri.altman-Sjgp3cTcYWE,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	peter.wang-NuS5LvNUpcJWk0Htik3J/w,
	matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, Stanley Chu

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* RE: [PATCH v1 1/1] scsi: ufs: Print uic error history in time order
@ 2019-01-30 10:19 Bean Huo (beanhuo)
       [not found] ` <BYAPR08MB4533E3AEBFF64A2ABB33EB45DB900-73df4QikVELese8zA3WVkpNArRD3w/9+vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Bean Huo (beanhuo) @ 2019-01-30 10:19 UTC (permalink / raw)
  To: Stanley Chu, 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

Hi, Stanley
I tested it on my own platform. This is very useful and thanks.

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

Reviewed-by: Bean Huo <beanhuo-AL4WhLSQfzjQT0dZR+AlfA@public.gmane.org>
Tested-by: Bean Huo <beanhuo-AL4WhLSQfzjQT0dZR+AlfA@public.gmane.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-05  3:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-28 14:04 [PATCH v1 1/1] scsi: ufs: Print uic error history in time order Stanley Chu
     [not found] ` <1548684266-8792-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-01-29  7:28   ` 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

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