diff mbox series

[for-next,07/13] RDMA/hns: Use macro instead of magic number

Message ID 1532503781-45205-8-git-send-email-oulijun@huawei.com (mailing list archive)
State Changes Requested
Headers show
Series Updates hns for v4.19 | expand

Commit Message

Lijun Ou July 25, 2018, 7:29 a.m. UTC
This patch mainly uses CMD_CSQ_DESC_NUM instead of magic number
in order to readability

Signed-off-by: Lijun Ou <oulijun@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++--
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Jason Gunthorpe July 26, 2018, 10:43 p.m. UTC | #1
On Wed, Jul 25, 2018 at 03:29:35PM +0800, Lijun Ou wrote:
> This patch mainly uses CMD_CSQ_DESC_NUM instead of magic number
> in order to readability
> 
> Signed-off-by: Lijun Ou <oulijun@huawei.com>
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++--
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 3 +++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> index cb677f0..54d8c80 100644
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> @@ -701,8 +701,8 @@ static int hns_roce_v2_cmq_init(struct hns_roce_dev *hr_dev)
>  	int ret;
>  
>  	/* Setup the queue entries for command queue */
> -	priv->cmq.csq.desc_num = 1024;
> -	priv->cmq.crq.desc_num = 1024;
> +	priv->cmq.csq.desc_num = CMD_CSQ_DESC_NUM;
> +	priv->cmq.crq.desc_num = CMD_CRQ_DESC_NUM;
>  
>  	/* Setup the lock for command queue */
>  	spin_lock_init(&priv->cmq.csq.lock);
> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
> index 3e568b6..76fef4e 100644
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
> @@ -112,6 +112,9 @@
>  	(step_idx == 1 && hop_num == 1) || \
>  	(step_idx == 2 && hop_num == 2))
>  
> +#define CMD_CSQ_DESC_NUM (1024)
> +#define CMD_CRQ_DESC_NUM (1024)

The () is unneeded, prefer not to see it

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index cb677f0..54d8c80 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -701,8 +701,8 @@  static int hns_roce_v2_cmq_init(struct hns_roce_dev *hr_dev)
 	int ret;
 
 	/* Setup the queue entries for command queue */
-	priv->cmq.csq.desc_num = 1024;
-	priv->cmq.crq.desc_num = 1024;
+	priv->cmq.csq.desc_num = CMD_CSQ_DESC_NUM;
+	priv->cmq.crq.desc_num = CMD_CRQ_DESC_NUM;
 
 	/* Setup the lock for command queue */
 	spin_lock_init(&priv->cmq.csq.lock);
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
index 3e568b6..76fef4e 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
@@ -112,6 +112,9 @@ 
 	(step_idx == 1 && hop_num == 1) || \
 	(step_idx == 2 && hop_num == 2))
 
+#define CMD_CSQ_DESC_NUM (1024)
+#define CMD_CRQ_DESC_NUM (1024)
+
 enum {
 	NO_ARMED = 0x0,
 	REG_NXT_CEQE = 0x2,