Re: [PATCH for-next 7/7] RDMA/hns: Fix coding style issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 06, 2020 at 08:21:16PM +0800, Weihang Li wrote:
> From: Lijun Ou <oulijun@xxxxxxxxxx>
> 
> Fix some coding style issuses without changing logic of codes, most of the
> modification is unreasonable line breaks and alignments.
> 
> Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx>
> Signed-off-by: Lang Cheng <chenglang@xxxxxxxxxx>
> Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx>
> ---
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 167 ++++++++++-------------------
>  drivers/infiniband/hw/hns/hns_roce_main.c  |  56 +++++-----
>  2 files changed, 86 insertions(+), 137 deletions(-)

If you are going to be re-intending code please at least refer to
clang-format's presentation. I recommend clang-format as an
interactive editor plugin to do single statement reformatting on
demand to help follow the coding style.

I ran it over the lines changed here and it suggested the below, which
seems like a reasonable improvement so I folded it in:
 - One line is better than two
 - Subexpressions crossing lines should be indented more than the
   normal indent. ie
    foo(a &
          B,
        c)
 - ?: should line up under the ?

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index f15690fa56db47..00fd40fd8380e7 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1366,8 +1366,7 @@ static int hns_roce_query_pf_timer_resource(struct hns_roce_dev *hr_dev)
 	return 0;
 }
 
-static int hns_roce_set_vf_switch_param(struct hns_roce_dev *hr_dev,
-					int vf_id)
+static int hns_roce_set_vf_switch_param(struct hns_roce_dev *hr_dev, int vf_id)
 {
 	struct hns_roce_cmq_desc desc;
 	struct hns_roce_vf_switch *swt;
@@ -1821,12 +1820,12 @@ static int hns_roce_config_link_table(struct hns_roce_dev *hr_dev,
 			roce_set_field(req_b->tail_ba_h, CFG_LLM_TAIL_BA_H_M,
 				       CFG_LLM_TAIL_BA_H_S,
 				       entry[page_num - 1].blk_ba1_nxt_ptr &
-				       HNS_ROCE_LINK_TABLE_BA1_M);
+					       HNS_ROCE_LINK_TABLE_BA1_M);
 			roce_set_field(req_b->tail_ptr, CFG_LLM_TAIL_PTR_M,
 				       CFG_LLM_TAIL_PTR_S,
 				       (entry[page_num - 2].blk_ba1_nxt_ptr &
-				       HNS_ROCE_LINK_TABLE_NXT_PTR_M) >>
-				       HNS_ROCE_LINK_TABLE_NXT_PTR_S);
+					HNS_ROCE_LINK_TABLE_NXT_PTR_M) >>
+					       HNS_ROCE_LINK_TABLE_NXT_PTR_S);
 		}
 	}
 	roce_set_field(req_a->depth_pgsz_init_en, CFG_LLM_INIT_EN_M,
@@ -2398,8 +2397,8 @@ static int hns_roce_v2_mw_write_mtpt(void *mb_buf, struct hns_roce_mw *mw)
 		       V2_MPT_BYTE_4_PD_S, mw->pdn);
 	roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_PBL_HOP_NUM_M,
 		       V2_MPT_BYTE_4_PBL_HOP_NUM_S,
-		       mw->pbl_hop_num == HNS_ROCE_HOP_NUM_0 ?
-		       0 : mw->pbl_hop_num);
+		       mw->pbl_hop_num == HNS_ROCE_HOP_NUM_0 ? 0 :
+							       mw->pbl_hop_num);
 	roce_set_field(mpt_entry->byte_4_pd_hop_st,
 		       V2_MPT_BYTE_4_PBL_BA_PG_SZ_M,
 		       V2_MPT_BYTE_4_PBL_BA_PG_SZ_S,
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index ac2e426c62504f..84e4707337a9b7 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -260,10 +260,11 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u8 port_num,
 	mtu = iboe_get_mtu(net_dev->mtu);
 	props->active_mtu = mtu ? min(props->max_mtu, mtu) : IB_MTU_256;
 	props->state = netif_running(net_dev) && netif_carrier_ok(net_dev) ?
-		       IB_PORT_ACTIVE : IB_PORT_DOWN;
+			       IB_PORT_ACTIVE :
+			       IB_PORT_DOWN;
 	props->phys_state = props->state == IB_PORT_ACTIVE ?
-			    IB_PORT_PHYS_STATE_LINK_UP :
-			    IB_PORT_PHYS_STATE_DISABLED;
+				    IB_PORT_PHYS_STATE_LINK_UP :
+				    IB_PORT_PHYS_STATE_DISABLED;
 
 	spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux