kernel/patches/0689-scsi-hisi_sas-Replace-magic-number-when-handle-chann.patch

82 lines
2.7 KiB
Diff

From 44fcad1ae412d4d1743c3242302c05f1f3400a4a Mon Sep 17 00:00:00 2001
From: Luo Jiaxing <luojiaxing@huawei.com>
Date: Mon, 20 Jan 2020 20:22:33 +0800
Subject: [PATCH 041/108] scsi: hisi_sas: Replace magic number when handle
channel interrupt
mainline inclusion
from mainline-v5.6-rc1
commit d2815fdf9a0e6c629d062f9a7e24cb7cdbef3dee
category: feature
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8EKNE
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d2815fdf9a0e6c629d062f9a7e24cb7cdbef3dee
----------------------------------------------------------------------
We use magic number as offset and mask when handle channel interrupt, so
use macro to replace it.
Link: https://lore.kernel.org/r/1579522957-4393-4-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
Conflicts:
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
---
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index 500fd6e54f38..c8328e1ef166 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -540,6 +540,13 @@ struct hisi_sas_err_record_v3 {
(op == READ_16) || (op == WRITE_16) || \
(op == READ_32) || (op == WRITE_32))
+#define CHNL_INT_STS_MSK 0xeeeeeeee
+#define CHNL_INT_STS_PHY_MSK 0xe
+#define CHNL_INT_STS_INT0_MSK BIT(1)
+#define CHNL_INT_STS_INT1_MSK BIT(2)
+#define CHNL_INT_STS_INT2_MSK BIT(3)
+#define CHNL_WIDTH 4
+
enum {
DSM_FUNC_ERR_HANDLE_MSI = 0,
};
@@ -1945,22 +1952,23 @@ static irqreturn_t int_chnl_int_v3_hw(int irq_no, void *p)
int phy_no = 0;
irq_msk = hisi_sas_read32(hisi_hba, CHNL_INT_STATUS)
- & 0xeeeeeeee;
+ & CHNL_INT_STS_MSK;
+
/*
* These three irqs mask save at high 3 bit, the last bit
* is reserved. So we use 0xe to clear those after handle.
*/
while (irq_msk) {
- if (irq_msk & (2 << (phy_no * 4)))
+ if (irq_msk & (CHNL_INT_STS_INT0_MSK << (phy_no * CHNL_WIDTH)))
handle_chl_int0_v3_hw(hisi_hba, phy_no);
- if (irq_msk & (4 << (phy_no * 4)))
+ if (irq_msk & (CHNL_INT_STS_INT1_MSK << (phy_no * CHNL_WIDTH)))
handle_chl_int1_v3_hw(hisi_hba, phy_no);
- if (irq_msk & (8 << (phy_no * 4)))
+ if (irq_msk & (CHNL_INT_STS_INT2_MSK << (phy_no * CHNL_WIDTH)))
handle_chl_int2_v3_hw(hisi_hba, phy_no);
- irq_msk &= ~(0xe << (phy_no * 4));
+ irq_msk &= ~(CHNL_INT_STS_PHY_MSK << (phy_no * CHNL_WIDTH));
phy_no++;
}
--
2.27.0