linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Weihang Li <liweihang@hisilicon.com>
To: <dledford@redhat.com>, <jgg@ziepe.ca>
Cc: <linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH v2 for-next 7/9] RDMA/hns: Modify hns_roce_hw_v2_get_cfg to simplify the code
Date: Tue, 5 Nov 2019 19:08:00 +0800	[thread overview]
Message-ID: <1572952082-6681-8-git-send-email-liweihang@hisilicon.com> (raw)
In-Reply-To: <1572952082-6681-1-git-send-email-liweihang@hisilicon.com>

From: Lang Cheng <chenglang@huawei.com>

Merge base configuration of hr_dev into hns_roce_hw_v2_get_cfg(). In
addition, there is no need to return 0 at last, so we change return
type of it to void.

Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@hisilicon.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index f65bd7a..fdc0cd6 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -6370,12 +6370,14 @@ static const struct pci_device_id hns_roce_hw_v2_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, hns_roce_hw_v2_pci_tbl);
 
-static int hns_roce_hw_v2_get_cfg(struct hns_roce_dev *hr_dev,
+static void hns_roce_hw_v2_get_cfg(struct hns_roce_dev *hr_dev,
 				  struct hnae3_handle *handle)
 {
 	struct hns_roce_v2_priv *priv = hr_dev->priv;
 	int i;
 
+	hr_dev->pci_dev = handle->pdev;
+	hr_dev->dev = &handle->pdev->dev;
 	hr_dev->hw = &hns_roce_hw_v2;
 	hr_dev->dfx = &hns_roce_dfx_hw_v2;
 	hr_dev->sdb_offset = ROCEE_DB_SQ_L_0_REG;
@@ -6400,8 +6402,6 @@ static int hns_roce_hw_v2_get_cfg(struct hns_roce_dev *hr_dev,
 
 	hr_dev->reset_cnt = handle->ae_algo->ops->ae_dev_reset_cnt(handle);
 	priv->handle = handle;
-
-	return 0;
 }
 
 static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)
@@ -6419,14 +6419,7 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)
 		goto error_failed_kzalloc;
 	}
 
-	hr_dev->pci_dev = handle->pdev;
-	hr_dev->dev = &handle->pdev->dev;
-
-	ret = hns_roce_hw_v2_get_cfg(hr_dev, handle);
-	if (ret) {
-		dev_err(hr_dev->dev, "Get Configuration failed!\n");
-		goto error_failed_get_cfg;
-	}
+	hns_roce_hw_v2_get_cfg(hr_dev, handle);
 
 	ret = hns_roce_init(hr_dev);
 	if (ret) {
-- 
2.8.1


  parent reply	other threads:[~2019-11-05 11:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 11:07 [PATCH v2 for-next 0/9] RDMA/hns: Cleanups for hip08 Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 1/9] RDMA/hns: Delete unnecessary variable max_post Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 2/9] RDMA/hns: Remove unnecessary structure hns_roce_sqp Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 3/9] RDMA/hns: Delete unnecessary uar from hns_roce_cq Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 4/9] RDMA/hns: Modify fields of struct hns_roce_srq Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 5/9] RDMA/hns: Replace not intuitive function/macro names Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 6/9] RDMA/hns: Simplify doorbell initialization code Weihang Li
2019-11-05 11:08 ` Weihang Li [this message]
2019-11-05 11:08 ` [PATCH v2 for-next 8/9] RDMA/hns: Fix non-standard error codes Weihang Li
2019-11-05 17:00   ` Leon Romanovsky
2019-11-06 10:44     ` Weihang Li
2019-11-06 15:43       ` Leon Romanovsky
2019-11-08  8:11         ` Weihang Li
2019-11-05 11:08 ` [PATCH v2 for-next 9/9] RDMA/hns: Modify appropriate printings Weihang Li
2019-11-08 20:45 ` [PATCH v2 for-next 0/9] RDMA/hns: Cleanups for hip08 Jason Gunthorpe
2019-11-09  2:18   ` Weihang Li

Reply instructions:

You may reply publicly 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=1572952082-6681-8-git-send-email-liweihang@hisilicon.com \
    --to=liweihang@hisilicon.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).