Skip to contentSkip to conversation

scsi: ufs: Print uic error history in time order

PATCH Applied Stanley Chu 3 participants 3 messages Jan 28, 2019 – Feb 5, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: Print uic error history in time order

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.

---
 drivers/scsi/ufs/ufshcd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +6 -1
index 9ba7671b84f8..f90badcb8318 100644
@@ -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)
Signature · 1 line
2.18.0
#3 lore raw
In reply to a message not in the archive

Stanley,

Quoted 4 lines

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.

Applied to 5.1/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering