From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, jgg@ziepe.ca,
leon@kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: [PATCH 6/8] RDMA/rtrs: Clean up rtrs_rdma_dev_pd_ops
Date: Wed, 16 Nov 2022 19:13:58 +0800 [thread overview]
Message-ID: <20221116111400.7203-7-guoqing.jiang@linux.dev> (raw)
In-Reply-To: <20221116111400.7203-1-guoqing.jiang@linux.dev>
Let's remove them since the three members are not used.
Acked-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
drivers/infiniband/ulp/rtrs/rtrs-pri.h | 3 ---
drivers/infiniband/ulp/rtrs/rtrs.c | 22 ++++------------------
2 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h
index a2420eecaf5a..ab25619261d2 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h
+++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h
@@ -68,10 +68,7 @@ enum {
struct rtrs_ib_dev;
struct rtrs_rdma_dev_pd_ops {
- struct rtrs_ib_dev *(*alloc)(void);
- void (*free)(struct rtrs_ib_dev *dev);
int (*init)(struct rtrs_ib_dev *dev);
- void (*deinit)(struct rtrs_ib_dev *dev);
};
struct rtrs_rdma_dev_pd {
diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c
index ed324b47d93a..4bf9d868cc52 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs.c
@@ -557,7 +557,6 @@ EXPORT_SYMBOL(rtrs_addr_to_sockaddr);
void rtrs_rdma_dev_pd_init(enum ib_pd_flags pd_flags,
struct rtrs_rdma_dev_pd *pool)
{
- WARN_ON(pool->ops && (!pool->ops->alloc ^ !pool->ops->free));
INIT_LIST_HEAD(&pool->list);
mutex_init(&pool->mutex);
pool->pd_flags = pd_flags;
@@ -583,15 +582,8 @@ static void dev_free(struct kref *ref)
list_del(&dev->entry);
mutex_unlock(&pool->mutex);
- if (pool->ops && pool->ops->deinit)
- pool->ops->deinit(dev);
-
ib_dealloc_pd(dev->ib_pd);
-
- if (pool->ops && pool->ops->free)
- pool->ops->free(dev);
- else
- kfree(dev);
+ kfree(dev);
}
int rtrs_ib_dev_put(struct rtrs_ib_dev *dev)
@@ -618,11 +610,8 @@ rtrs_ib_dev_find_or_add(struct ib_device *ib_dev,
goto out_unlock;
}
mutex_unlock(&pool->mutex);
- if (pool->ops && pool->ops->alloc)
- dev = pool->ops->alloc();
- else
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- if (IS_ERR_OR_NULL(dev))
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev)
goto out_err;
kref_init(&dev->ref);
@@ -644,10 +633,7 @@ rtrs_ib_dev_find_or_add(struct ib_device *ib_dev,
out_free_pd:
ib_dealloc_pd(dev->ib_pd);
out_free_dev:
- if (pool->ops && pool->ops->free)
- pool->ops->free(dev);
- else
- kfree(dev);
+ kfree(dev);
out_err:
return NULL;
}
--
2.31.1
next prev parent reply other threads:[~2022-11-16 11:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 11:13 [PATCH 0/8] Misc patches for rtrs Guoqing Jiang
2022-11-16 11:13 ` [PATCH 1/8] RDMA/rtrs-srv: Refactor rtrs_srv_rdma_cm_handler Guoqing Jiang
2022-11-17 5:52 ` Jinpu Wang
2022-11-17 7:11 ` Guoqing Jiang
2022-11-16 11:13 ` [PATCH 2/8] RDMA/rtrs-srv: Refactor the handling of failure case in map_cont_bufs Guoqing Jiang
2022-11-16 11:13 ` [PATCH 3/8] RDMA/rtrs-srv: Correct the checking of ib_map_mr_sg Guoqing Jiang
2022-11-17 5:55 ` Jinpu Wang
2022-11-16 11:13 ` [PATCH 4/8] RDMA/rtrs-clt: " Guoqing Jiang
2022-11-17 5:56 ` Jinpu Wang
2022-11-16 11:13 ` [PATCH 5/8] RDMA/rtrs-srv: Remove outdated comments from create_con Guoqing Jiang
2022-11-16 11:13 ` Guoqing Jiang [this message]
2022-11-16 11:13 ` [PATCH 7/8] RDMA/rtrs-srv: Fix several issues in rtrs_srv_destroy_path_files Guoqing Jiang
2022-11-16 11:14 ` [PATCH 8/8] RDMA/rtrs-srv: Remove kobject_del from rtrs_srv_destroy_once_sysfs_root_folders Guoqing Jiang
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=20221116111400.7203-7-guoqing.jiang@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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