Commit 2f12a499 authored by Luo Jiaxing's avatar Luo Jiaxing Committed by Martin K. Petersen

scsi: hisi_sas: Include HZ in timer macros

Include HZ in timer macros to make the code more concise.

Link: https://lore.kernel.org/r/1623058179-80434-4-git-send-email-john.garry@huawei.comSigned-off-by: default avatarLuo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0f757339
...@@ -91,8 +91,8 @@ ...@@ -91,8 +91,8 @@
#define HISI_SAS_PROT_MASK (HISI_SAS_DIF_PROT_MASK | HISI_SAS_DIX_PROT_MASK) #define HISI_SAS_PROT_MASK (HISI_SAS_DIF_PROT_MASK | HISI_SAS_DIX_PROT_MASK)
#define HISI_SAS_WAIT_PHYUP_TIMEOUT 20 #define HISI_SAS_WAIT_PHYUP_TIMEOUT (20 * HZ)
#define CLEAR_ITCT_TIMEOUT 20 #define HISI_SAS_CLEAR_ITCT_TIMEOUT (20 * HZ)
struct hisi_hba; struct hisi_hba;
......
...@@ -915,7 +915,7 @@ void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no) ...@@ -915,7 +915,7 @@ void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no)
if (phy->wait_phyup_cnt < HISI_SAS_WAIT_PHYUP_RETRIES) { if (phy->wait_phyup_cnt < HISI_SAS_WAIT_PHYUP_RETRIES) {
phy->wait_phyup_cnt++; phy->wait_phyup_cnt++;
phy->timer.expires = jiffies + phy->timer.expires = jiffies +
HISI_SAS_WAIT_PHYUP_TIMEOUT * HZ; HISI_SAS_WAIT_PHYUP_TIMEOUT;
add_timer(&phy->timer); add_timer(&phy->timer);
} else { } else {
dev_warn(dev, "phy%d failed to come up %d times, giving up\n", dev_warn(dev, "phy%d failed to come up %d times, giving up\n",
...@@ -1193,9 +1193,9 @@ static void hisi_sas_tmf_timedout(struct timer_list *t) ...@@ -1193,9 +1193,9 @@ static void hisi_sas_tmf_timedout(struct timer_list *t)
complete(&task->slow_task->completion); complete(&task->slow_task->completion);
} }
#define TASK_TIMEOUT 20 #define TASK_TIMEOUT (20 * HZ)
#define TASK_RETRY 3 #define TASK_RETRY 3
#define INTERNAL_ABORT_TIMEOUT 6 #define INTERNAL_ABORT_TIMEOUT (6 * HZ)
static int hisi_sas_exec_internal_tmf_task(struct domain_device *device, static int hisi_sas_exec_internal_tmf_task(struct domain_device *device,
void *parameter, u32 para_len, void *parameter, u32 para_len,
struct hisi_sas_tmf_task *tmf) struct hisi_sas_tmf_task *tmf)
...@@ -1223,7 +1223,7 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device, ...@@ -1223,7 +1223,7 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device,
task->task_done = hisi_sas_task_done; task->task_done = hisi_sas_task_done;
task->slow_task->timer.function = hisi_sas_tmf_timedout; task->slow_task->timer.function = hisi_sas_tmf_timedout;
task->slow_task->timer.expires = jiffies + TASK_TIMEOUT * HZ; task->slow_task->timer.expires = jiffies + TASK_TIMEOUT;
add_timer(&task->slow_task->timer); add_timer(&task->slow_task->timer);
res = hisi_sas_task_exec(task, GFP_KERNEL, 1, tmf); res = hisi_sas_task_exec(task, GFP_KERNEL, 1, tmf);
...@@ -1761,6 +1761,8 @@ static int hisi_sas_clear_aca(struct domain_device *device, u8 *lun) ...@@ -1761,6 +1761,8 @@ static int hisi_sas_clear_aca(struct domain_device *device, u8 *lun)
return rc; return rc;
} }
#define I_T_NEXUS_RESET_PHYUP_TIMEOUT (2 * HZ)
static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device) static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device)
{ {
struct sas_phy *local_phy = sas_get_local_phy(device); struct sas_phy *local_phy = sas_get_local_phy(device);
...@@ -1795,7 +1797,8 @@ static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device) ...@@ -1795,7 +1797,8 @@ static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device)
sas_ha->sas_phy[local_phy->number]; sas_ha->sas_phy[local_phy->number];
struct hisi_sas_phy *phy = struct hisi_sas_phy *phy =
container_of(sas_phy, struct hisi_sas_phy, sas_phy); container_of(sas_phy, struct hisi_sas_phy, sas_phy);
int ret = wait_for_completion_timeout(&phyreset, 2 * HZ); int ret = wait_for_completion_timeout(&phyreset,
I_T_NEXUS_RESET_PHYUP_TIMEOUT);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&phy->lock, flags); spin_lock_irqsave(&phy->lock, flags);
...@@ -2079,7 +2082,7 @@ _hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba, ...@@ -2079,7 +2082,7 @@ _hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,
task->task_proto = device->tproto; task->task_proto = device->tproto;
task->task_done = hisi_sas_task_done; task->task_done = hisi_sas_task_done;
task->slow_task->timer.function = hisi_sas_tmf_timedout; task->slow_task->timer.function = hisi_sas_tmf_timedout;
task->slow_task->timer.expires = jiffies + INTERNAL_ABORT_TIMEOUT * HZ; task->slow_task->timer.expires = jiffies + INTERNAL_ABORT_TIMEOUT;
add_timer(&task->slow_task->timer); add_timer(&task->slow_task->timer);
res = hisi_sas_internal_abort_task_exec(hisi_hba, sas_dev->device_id, res = hisi_sas_internal_abort_task_exec(hisi_hba, sas_dev->device_id,
......
...@@ -994,7 +994,7 @@ static int clear_itct_v2_hw(struct hisi_hba *hisi_hba, ...@@ -994,7 +994,7 @@ static int clear_itct_v2_hw(struct hisi_hba *hisi_hba,
reg_val = ITCT_CLR_EN_MSK | (dev_id & ITCT_DEV_MSK); reg_val = ITCT_CLR_EN_MSK | (dev_id & ITCT_DEV_MSK);
hisi_sas_write32(hisi_hba, ITCT_CLR, reg_val); hisi_sas_write32(hisi_hba, ITCT_CLR, reg_val);
if (!wait_for_completion_timeout(sas_dev->completion, if (!wait_for_completion_timeout(sas_dev->completion,
CLEAR_ITCT_TIMEOUT * HZ)) { HISI_SAS_CLEAR_ITCT_TIMEOUT)) {
dev_warn(dev, "failed to clear ITCT\n"); dev_warn(dev, "failed to clear ITCT\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
...@@ -843,7 +843,7 @@ static int clear_itct_v3_hw(struct hisi_hba *hisi_hba, ...@@ -843,7 +843,7 @@ static int clear_itct_v3_hw(struct hisi_hba *hisi_hba,
hisi_sas_write32(hisi_hba, ITCT_CLR, reg_val); hisi_sas_write32(hisi_hba, ITCT_CLR, reg_val);
if (!wait_for_completion_timeout(sas_dev->completion, if (!wait_for_completion_timeout(sas_dev->completion,
CLEAR_ITCT_TIMEOUT * HZ)) { HISI_SAS_CLEAR_ITCT_TIMEOUT)) {
dev_warn(dev, "failed to clear ITCT\n"); dev_warn(dev, "failed to clear ITCT\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment