diff options
author | Stanley Chu <stanley.chu@mediatek.com> | 2019-01-28 22:04:26 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-02-04 21:53:17 -0500 |
commit | 27752647f88a1b03019e03f21f32b60452af7d4b (patch) | |
tree | 36ccd21839c18c2c2f6be6e1c1248707381df4df /drivers | |
parent | 47eefded1f70c1b6c77bee18bd1bf5d17642dcb9 (diff) | |
download | lwn-27752647f88a1b03019e03f21f32b60452af7d4b.tar.gz lwn-27752647f88a1b03019e03f21f32b60452af7d4b.zip |
scsi: ufs: Print uic error history in time order
uic errors are currently printed out of time order.
Make things more readable by printing logs in time order, and printing
"No record" if history is empty.
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Tested-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) |