From: Bart Van Assche <Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
To: "dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org"
<dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: "andrew.boyer-8PEkshWhKlo@public.gmane.org"
<andrew.boyer-8PEkshWhKlo@public.gmane.org>,
"monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
<monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 07/15] IB/rxe: Let the compiler check the type of the cleanup functions
Date: Mon, 2 Jan 2017 10:41:23 +0000 [thread overview]
Message-ID: <1483353591.3592.26.camel@sandisk.com> (raw)
In-Reply-To: <1483353316.3592.14.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Change the argument type of these functions from void * into
struct rxe_pool_entry *.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Moni Shoua <monis@mellanox.com>
Cc: Andrew Boyer <andrew.boyer@dell.com>
---
drivers/infiniband/sw/rxe/rxe_cq.c | 4 ++--
drivers/infiniband/sw/rxe/rxe_loc.h | 8 ++++----
drivers/infiniband/sw/rxe/rxe_mcast.c | 4 ++--
drivers/infiniband/sw/rxe/rxe_mr.c | 4 ++--
drivers/infiniband/sw/rxe/rxe_pool.h | 6 ++++--
drivers/infiniband/sw/rxe/rxe_qp.c | 4 ++--
drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +-
7 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
index e5e6a5e7dee9..49fe42c23f4d 100644
--- a/drivers/infiniband/sw/rxe/rxe_cq.c
+++ b/drivers/infiniband/sw/rxe/rxe_cq.c
@@ -156,9 +156,9 @@ int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited)
return 0;
}
-void rxe_cq_cleanup(void *arg)
+void rxe_cq_cleanup(struct rxe_pool_entry *arg)
{
- struct rxe_cq *cq = arg;
+ struct rxe_cq *cq = container_of(arg, typeof(*cq), pelem);
if (cq->queue)
rxe_queue_cleanup(cq->queue);
diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
index efe4c6a35442..da191d7acb6f 100644
--- a/drivers/infiniband/sw/rxe/rxe_loc.h
+++ b/drivers/infiniband/sw/rxe/rxe_loc.h
@@ -64,7 +64,7 @@ int rxe_cq_resize_queue(struct rxe_cq *cq, int new_cqe, struct ib_udata *udata);
int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited);
-void rxe_cq_cleanup(void *arg);
+void rxe_cq_cleanup(struct rxe_pool_entry *arg);
/* rxe_mcast.c */
int rxe_mcast_get_grp(struct rxe_dev *rxe, union ib_gid *mgid,
@@ -78,7 +78,7 @@ int rxe_mcast_drop_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp,
void rxe_drop_all_mcast_groups(struct rxe_qp *qp);
-void rxe_mc_cleanup(void *arg);
+void rxe_mc_cleanup(struct rxe_pool_entry *arg);
/* rxe_mmap.c */
struct rxe_mmap_info {
@@ -137,7 +137,7 @@ int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length);
int rxe_mem_map_pages(struct rxe_dev *rxe, struct rxe_mem *mem,
u64 *page, int num_pages, u64 iova);
-void rxe_mem_cleanup(void *arg);
+void rxe_mem_cleanup(struct rxe_pool_entry *arg);
int advance_dma_data(struct rxe_dma_info *dma, unsigned int length);
@@ -162,7 +162,7 @@ void rxe_qp_error(struct rxe_qp *qp);
void rxe_qp_destroy(struct rxe_qp *qp);
-void rxe_qp_cleanup(void *arg);
+void rxe_qp_cleanup(struct rxe_pool_entry *arg);
static inline int qp_num(struct rxe_qp *qp)
{
diff --git a/drivers/infiniband/sw/rxe/rxe_mcast.c b/drivers/infiniband/sw/rxe/rxe_mcast.c
index fa95544ca7e0..e0fb6752f90e 100644
--- a/drivers/infiniband/sw/rxe/rxe_mcast.c
+++ b/drivers/infiniband/sw/rxe/rxe_mcast.c
@@ -180,9 +180,9 @@ void rxe_drop_all_mcast_groups(struct rxe_qp *qp)
}
}
-void rxe_mc_cleanup(void *arg)
+void rxe_mc_cleanup(struct rxe_pool_entry *arg)
{
- struct rxe_mc_grp *grp = arg;
+ struct rxe_mc_grp *grp = container_of(arg, typeof(*grp), pelem);
struct rxe_dev *rxe = grp->rxe;
rxe_drop_key(grp);
diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index d0faca294006..8ca3acd327b3 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -89,9 +89,9 @@ static void rxe_mem_init(int access, struct rxe_mem *mem)
mem->map_shift = ilog2(RXE_BUF_PER_MAP);
}
-void rxe_mem_cleanup(void *arg)
+void rxe_mem_cleanup(struct rxe_pool_entry *arg)
{
- struct rxe_mem *mem = arg;
+ struct rxe_mem *mem = container_of(arg, typeof(*mem), pelem);
int i;
if (mem->umem)
diff --git a/drivers/infiniband/sw/rxe/rxe_pool.h b/drivers/infiniband/sw/rxe/rxe_pool.h
index 7846ccc58b25..47df28e43acf 100644
--- a/drivers/infiniband/sw/rxe/rxe_pool.h
+++ b/drivers/infiniband/sw/rxe/rxe_pool.h
@@ -57,10 +57,12 @@ enum rxe_elem_type {
RXE_NUM_TYPES, /* keep me last */
};
+struct rxe_pool_entry;
+
struct rxe_type_info {
const char *name;
size_t size;
- void (*cleanup)(void *obj);
+ void (*cleanup)(struct rxe_pool_entry *obj);
enum rxe_pool_flags flags;
u32 max_index;
u32 min_index;
@@ -91,7 +93,7 @@ struct rxe_pool {
spinlock_t pool_lock; /* pool spinlock */
size_t elem_size;
struct kref ref_cnt;
- void (*cleanup)(void *obj);
+ void (*cleanup)(struct rxe_pool_entry *obj);
enum rxe_pool_state state;
enum rxe_pool_flags flags;
enum rxe_elem_type type;
diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index 486d576e55bc..917147ce4cf9 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -825,9 +825,9 @@ void rxe_qp_destroy(struct rxe_qp *qp)
}
/* called when the last reference to the qp is dropped */
-void rxe_qp_cleanup(void *arg)
+void rxe_qp_cleanup(struct rxe_pool_entry *arg)
{
- struct rxe_qp *qp = arg;
+ struct rxe_qp *qp = container_of(arg, typeof(*qp), pelem);
rxe_drop_all_mcast_groups(qp);
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index cac1d52a08f0..536974b69ed9 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -475,6 +475,6 @@ static inline struct rxe_mem *to_rmw(struct ib_mw *mw)
int rxe_register_device(struct rxe_dev *rxe);
int rxe_unregister_device(struct rxe_dev *rxe);
-void rxe_mc_cleanup(void *arg);
+void rxe_mc_cleanup(struct rxe_pool_entry *arg);
#endif /* RXE_VERBS_H */
--
2.11.0
next prev parent reply other threads:[~2017-01-02 10:41 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 10:35 [PATCH 00/15] IB/rxe patches for kernel v4.11 Bart Van Assche
[not found] ` <1483353316.3592.14.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-02 10:39 ` [PATCH 01/15] IB/rxe: Suppress sparse warnings Bart Van Assche
[not found] ` <1483353409.3592.15.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-05 12:59 ` Leon Romanovsky
[not found] ` <20170105125955.GB15685-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-09 12:42 ` Bart Van Assche
[not found] ` <1483965701.2923.0.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 13:13 ` Leon Romanovsky
2017-01-09 14:27 ` Boyer, Andrew
2017-01-02 10:39 ` [PATCH 02/15] IB/rxe: Constify the pool name Bart Van Assche
[not found] ` <1483353445.3592.17.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 9:40 ` Leon Romanovsky
2017-01-09 14:27 ` Boyer, Andrew
2017-01-02 10:39 ` [PATCH 03/15] IB/rxe: Remove an unused function Bart Van Assche
[not found] ` <1483353474.3592.18.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 9:39 ` Leon Romanovsky
2017-01-09 14:28 ` Boyer, Andrew
2017-01-02 10:40 ` [PATCH 04/15] IB/rxe: Remove an unused variable Bart Van Assche
[not found] ` <1483353498.3592.20.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-02 18:24 ` Leon Romanovsky
2017-01-03 18:39 ` Parav Pandit
[not found] ` <CAG53R5WnJy1cLdEZOpzk03aAE2L6v86n_-qEBpoaG+arymCxPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-04 10:37 ` Bart Van Assche
[not found] ` <1483526210.3048.6.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-04 12:29 ` Leon Romanovsky
2017-01-09 14:29 ` Boyer, Andrew
2017-01-02 10:40 ` [PATCH 05/15] IB/rxe: Remove superfluous casts Bart Van Assche
[not found] ` <1483353522.3592.22.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-05 6:48 ` Leon Romanovsky
2017-01-09 14:29 ` Boyer, Andrew
2017-01-02 10:40 ` [PATCH 06/15] IB/rxe: Enable type checking on SKB_TO_PKT() and PKT_TO_SKB() arguments Bart Van Assche
[not found] ` <1483353555.3592.24.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 9:44 ` Leon Romanovsky
2017-01-09 14:31 ` Boyer, Andrew
2017-01-02 10:41 ` Bart Van Assche [this message]
[not found] ` <1483353591.3592.26.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 14:22 ` [PATCH 07/15] IB/rxe: Let the compiler check the type of the cleanup functions Leon Romanovsky
2017-01-09 14:33 ` Boyer, Andrew
2017-01-02 10:41 ` [PATCH 08/15] IB/rxe: Issue warnings once Bart Van Assche
[not found] ` <1483353613.3592.28.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-04 14:18 ` Leon Romanovsky
2017-01-02 10:41 ` [PATCH 09/15] IB/rxe: Add a runtime check in alloc_index() Bart Van Assche
[not found] ` <1483353638.3592.30.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-04 17:27 ` Leon Romanovsky
[not found] ` <20170104172704.GU12077-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-04 18:38 ` Bart Van Assche
[not found] ` <1483555108.3101.1.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-05 6:43 ` Leon Romanovsky
2017-01-09 14:35 ` Boyer, Andrew
2017-01-02 10:42 ` [PATCH 10/15] IB/rxe: Introduce functions for queue draining Bart Van Assche
[not found] ` <1483353661.3592.32.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 15:06 ` Boyer, Andrew
[not found] ` <D49910D0.9088%Andrew.Boyer-mb1K0bWo544@public.gmane.org>
2017-01-09 15:11 ` Boyer, Andrew
2017-01-02 10:42 ` [PATCH 11/15] IB/rxe: Generate a completion for all failed work requests Bart Van Assche
[not found] ` <1483353685.3592.34.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 15:15 ` Boyer, Andrew
2017-01-02 10:43 ` [PATCH 12/15] IB/rxe: Fix a MR reference leak in check_rkey() Bart Van Assche
[not found] ` <1483353706.3592.35.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 14:42 ` Boyer, Andrew
2017-01-02 10:43 ` [PATCH 13/15] IB/rxe: Fix reference leaks in memory key invalidation code Bart Van Assche
[not found] ` <1483353732.3592.38.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 14:52 ` Boyer, Andrew
2017-01-02 10:43 ` [PATCH 14/15] IB/rxe: Remove a pointless indirection layer Bart Van Assche
[not found] ` <1483353755.3592.40.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-09 12:35 ` Leon Romanovsky
2017-01-09 15:09 ` Boyer, Andrew
2017-01-02 10:44 ` [PATCH 15/15] IB/rxe: Fix an skb leak Bart Van Assche
[not found] ` <1483353777.3592.42.camel-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2017-01-08 13:37 ` Leon Romanovsky
2017-01-09 14:59 ` Boyer, Andrew
2017-01-10 18:06 ` [PATCH 00/15] IB/rxe patches for kernel v4.11 Doug Ledford
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=1483353591.3592.26.camel@sandisk.com \
--to=bart.vanassche-xdaiopvojttbdgjk7y7tuq@public.gmane.org \
--cc=andrew.boyer-8PEkshWhKlo@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.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;
as well as URLs for NNTP newsgroup(s).