Skip to content

Commit

Permalink
RDMA/hns: Refactor irq request code
Browse files Browse the repository at this point in the history
Remove unnecessary if...else..., to make the code look simpler.

Signed-off-by: Lang Cheng <chenglang@huawei.com>
Link: https://lore.kernel.org/r/1565276034-97329-10-git-send-email-oulijun@huawei.com
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Lang Cheng authored and Doug Ledford committed Aug 12, 2019
1 parent e7f4044 commit bebdb83
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions drivers/infiniband/hw/hns/hns_roce_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5749,18 +5749,19 @@ static int __hns_roce_request_irq(struct hns_roce_dev *hr_dev, int irq_num,
}

/* irq contains: abnormal + AEQ + CEQ */
for (j = 0; j < irq_num; j++)
if (j < other_num)
snprintf((char *)hr_dev->irq_names[j],
HNS_ROCE_INT_NAME_LEN, "hns-abn-%d", j);
else if (j < (other_num + aeq_num))
snprintf((char *)hr_dev->irq_names[j],
HNS_ROCE_INT_NAME_LEN, "hns-aeq-%d",
j - other_num);
else
snprintf((char *)hr_dev->irq_names[j],
HNS_ROCE_INT_NAME_LEN, "hns-ceq-%d",
j - other_num - aeq_num);
for (j = 0; j < other_num; j++)
snprintf((char *)hr_dev->irq_names[j],
HNS_ROCE_INT_NAME_LEN, "hns-abn-%d", j);

for (j = other_num; j < (other_num + aeq_num); j++)
snprintf((char *)hr_dev->irq_names[j],
HNS_ROCE_INT_NAME_LEN, "hns-aeq-%d",
j - other_num);

for (j = (other_num + aeq_num); j < irq_num; j++)
snprintf((char *)hr_dev->irq_names[j],
HNS_ROCE_INT_NAME_LEN, "hns-ceq-%d",
j - other_num - aeq_num);

for (j = 0; j < irq_num; j++) {
if (j < other_num)
Expand Down

0 comments on commit bebdb83

Please sign in to comment.