Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Weihang Li <liweihang@huawei.com>
Cc: dledford@redhat.com, leon@kernel.org, linux-rdma@vger.kernel.org,
	linuxarm@huawei.com
Subject: Re: [PATCH for-next 7/7] RDMA/hns: Fix coding style issues
Date: Tue, 7 Jan 2020 16:31:21 -0400
Message-ID: <20200107203121.GA5313@ziepe.ca> (raw)
In-Reply-To: <1578313276-29080-8-git-send-email-liweihang@huawei.com>

On Mon, Jan 06, 2020 at 08:21:16PM +0800, Weihang Li wrote:
> From: Lijun Ou <oulijun@huawei.com>
> 
> 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@huawei.com>
> Signed-off-by: Lang Cheng <chenglang@huawei.com>
> Signed-off-by: Weihang Li <liweihang@huawei.com>
> ---
>  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);

  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 12:21 [PATCH for-next 0/7] RDMA/hns: Various cleanups Weihang Li
2020-01-06 12:21 ` [PATCH for-next 1/7] RDMA/hns: Avoid printing address of mtt page Weihang Li
2020-01-06 12:21 ` [PATCH for-next 2/7] RDMA/hns: Remove unused function hns_roce_init_eq_table() Weihang Li
2020-01-06 12:21 ` [PATCH for-next 3/7] RDMA/hns: Update the value of qp type Weihang Li
2020-01-06 12:21 ` [PATCH for-next 4/7] RDMA/hns: Delete unnessary parameters in hns_roce_v2_qp_modify() Weihang Li
2020-01-06 12:21 ` [PATCH for-next 5/7] RDMA/hns: Remove redundant print information Weihang Li
2020-01-06 12:21 ` [PATCH for-next 6/7] RDMA/hns: Replace custom macros HNS_ROCE_ALIGN_UP Weihang Li
2020-01-06 12:21 ` [PATCH for-next 7/7] RDMA/hns: Fix coding style issues Weihang Li
2020-01-07 20:31   ` Jason Gunthorpe [this message]
2020-01-08  1:42     ` Weihang Li
2020-01-07 20:31 ` [PATCH for-next 0/7] RDMA/hns: Various cleanups Jason Gunthorpe

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200107203121.GA5313@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liweihang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git