From: Salil Mehta <salil.mehta@huawei.com>
To: <dledford@redhat.com>
Cc: <salil.mehta@huawei.com>, <xavier.huwei@huawei.com>,
<oulijun@huawei.com>, <yisen.zhuang@huawei.com>,
<mehta.salil.lnk@gmail.com>, <xuwei5@hisilicon.com>,
<linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, Dongdong Huang <hdd.huang@huawei.com>
Subject: [PATCH V2 for-next 04/19] IB/hns: Simplify function of pd alloc and qp alloc
Date: Tue, 20 Sep 2016 17:06:57 +0100 [thread overview]
Message-ID: <20160920160712.1190216-5-salil.mehta@huawei.com> (raw)
In-Reply-To: <20160920160712.1190216-1-salil.mehta@huawei.com>
From: Lijun Ou <oulijun@huawei.com>
Hns_roce_pd_alloc and hns_roce_reserve_range_qp use unnecessary
transformation of parameters. This patch simplify these two
functions.
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Dongdong Huang(Donald) <hdd.huang@huawei.com>
Reviewed-by: Wei Hu <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_pd.c | 14 +-------------
drivers/infiniband/hw/hns/hns_roce_qp.c | 10 +---------
2 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c
index 4109f74..0cd6132 100644
--- a/drivers/infiniband/hw/hns/hns_roce_pd.c
+++ b/drivers/infiniband/hw/hns/hns_roce_pd.c
@@ -35,19 +35,7 @@
static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
{
- struct device *dev = &hr_dev->pdev->dev;
- unsigned long pd_number;
- int ret = 0;
-
- ret = hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, &pd_number);
- if (ret == -1) {
- dev_err(dev, "alloc pdn from pdbitmap failed\n");
- return -ENOMEM;
- }
-
- *pdn = pd_number;
-
- return 0;
+ return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn);
}
static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn)
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index dd94e41..73de1d3 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -112,16 +112,8 @@ static int hns_roce_reserve_range_qp(struct hns_roce_dev *hr_dev, int cnt,
int align, unsigned long *base)
{
struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;
- int ret = 0;
- unsigned long qpn;
-
- ret = hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, &qpn);
- if (ret == -1)
- return -ENOMEM;
- *base = qpn;
-
- return 0;
+ return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, base);
}
enum hns_roce_qp_state to_hns_roce_state(enum ib_qp_state state)
--
1.9.1
next prev parent reply other threads:[~2016-09-20 16:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-20 16:06 [PATCH V2 for-next 00/19] IB/hns: Fixes for various misc. bugs Salil Mehta
2016-09-20 16:06 ` [PATCH V2 for-next 01/19] IB/hns: Remove unused parameters in some functions Salil Mehta
2016-09-20 16:06 ` [PATCH V2 for-next 02/19] IB/hns: Remove parameters of resize cq Salil Mehta
2016-09-20 16:06 ` [PATCH V2 for-next 03/19] IB/hns: Fix bug of using uninit refcount and free Salil Mehta
2016-09-20 16:06 ` Salil Mehta [this message]
2016-09-20 16:06 ` [PATCH V2 for-next 05/19] IB/hns: Remove unused parameter named qp_type Salil Mehta
2016-09-20 16:06 ` [PATCH V2 for-next 06/19] IB/hns: Fix bug of clear hem Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 07/19] IB/hns: Delete the sqp_start from the structure hns_roce_caps Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 08/19] IB/hns: Optimize code of aeq and ceq interrupt handle and fix the bug of qpn Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 09/19] IB/hns: Modify the init of iboe lock Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 10/19] IB/hns: Fix bug of memory leakage for registering user mr Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 11/19] IB/hns: Return bad wr while post send failed Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 12/19] IB/hns: The Ack timeout need a lower limit value Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 13/19] IB/hns: Some items of qpc need to take user param Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 14/19] IB/hns: Validate mtu when modified qp Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 15/19] IB/hns: Cq has not been freed Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 16/19] IB/hns: Update the rq head when modify qp state Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 17/19] IB/hns: Fix the bug when platform_get_resource() exec fail Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 18/19] IB/hns: Delete the redundant lines in hns_roce_v1_m_qp() Salil Mehta
2016-09-20 16:07 ` [PATCH V2 for-next 19/19] IB/hns: Fix for removal of redundant code Salil Mehta
2016-09-22 13:37 ` [PATCH V2 for-next 00/19] IB/hns: Fixes for various misc. bugs Leon Romanovsky
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=20160920160712.1190216-5-salil.mehta@huawei.com \
--to=salil.mehta@huawei.com \
--cc=dledford@redhat.com \
--cc=hdd.huang@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mehta.salil.lnk@gmail.com \
--cc=oulijun@huawei.com \
--cc=xavier.huwei@huawei.com \
--cc=xuwei5@hisilicon.com \
--cc=yisen.zhuang@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
all inboxes | Powered by JetHome®