diff options
author | Parav Pandit <parav@mellanox.com> | 2020-01-26 16:26:52 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-02-11 14:00:40 -0400 |
commit | 43fb5892cdfaa3bbe170aade07d4a38086636cca (patch) | |
tree | 12519dc56759413a1c3e0f1c75cc28178c2bc758 /drivers/infiniband/core | |
parent | e368d23f57f6a08341d35c44255f2d8e7695152b (diff) | |
download | linux-43fb5892cdfaa3bbe170aade07d4a38086636cca.tar.gz linux-43fb5892cdfaa3bbe170aade07d4a38086636cca.tar.bz2 linux-43fb5892cdfaa3bbe170aade07d4a38086636cca.zip |
RDMA/cma: Use refcount API to reflect refcount
Use a refcount_t for atomics being used as a refcount.
Link: https://lore.kernel.org/r/20200126142652.104803-8-leon@kernel.org
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/cma.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/core/cma_priv.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 605afeed122f..5165158a7aaa 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -842,12 +842,12 @@ found: static void cma_id_get(struct rdma_id_private *id_priv) { - atomic_inc(&id_priv->refcount); + refcount_inc(&id_priv->refcount); } static void cma_id_put(struct rdma_id_private *id_priv) { - if (atomic_dec_and_test(&id_priv->refcount)) + if (refcount_dec_and_test(&id_priv->refcount)) complete(&id_priv->comp); } @@ -875,7 +875,7 @@ struct rdma_cm_id *__rdma_create_id(struct net *net, spin_lock_init(&id_priv->lock); mutex_init(&id_priv->qp_mutex); init_completion(&id_priv->comp); - atomic_set(&id_priv->refcount, 1); + refcount_set(&id_priv->refcount, 1); mutex_init(&id_priv->handler_mutex); INIT_LIST_HEAD(&id_priv->listen_list); INIT_LIST_HEAD(&id_priv->mc_list); diff --git a/drivers/infiniband/core/cma_priv.h b/drivers/infiniband/core/cma_priv.h index 4e04c442ff86..5edcf44a9307 100644 --- a/drivers/infiniband/core/cma_priv.h +++ b/drivers/infiniband/core/cma_priv.h @@ -66,7 +66,7 @@ struct rdma_id_private { struct mutex qp_mutex; struct completion comp; - atomic_t refcount; + refcount_t refcount; struct mutex handler_mutex; int backlog; |