diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-04 11:32:10 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-09 11:26:17 -0600 |
commit | 6f258884ddac5195e76dc916ff5a3965db7836aa (patch) | |
tree | d7404318dea16648617bec80eaa30daeca4545a0 /drivers/infiniband/core/rdma_core.c | |
parent | IB/uverbs: Replace file->ucontext with file in uverbs_cmd.c (diff) | |
download | linux-dev-6f258884ddac5195e76dc916ff5a3965db7836aa.tar.xz linux-dev-6f258884ddac5195e76dc916ff5a3965db7836aa.zip |
IB/uverbs: Tidy up remaining references to ucontext
Unnecessary clutter, to indirect through ucontext when the ufile would do.
Generally most of the code code should only be working with ufile, except
for a few places that touch the driver interface.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/rdma_core.c')
-rw-r--r-- | drivers/infiniband/core/rdma_core.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c index dcaf3813ee78..98e55cb118ab 100644 --- a/drivers/infiniband/core/rdma_core.c +++ b/drivers/infiniband/core/rdma_core.c @@ -180,19 +180,19 @@ static int idr_add_uobj(struct ib_uobject *uobj) int ret; idr_preload(GFP_KERNEL); - spin_lock(&uobj->context->ufile->idr_lock); + spin_lock(&uobj->ufile->idr_lock); /* * We start with allocating an idr pointing to NULL. This represents an * object which isn't initialized yet. We'll replace it later on with * the real object once we commit. */ - ret = idr_alloc(&uobj->context->ufile->idr, NULL, 0, + ret = idr_alloc(&uobj->ufile->idr, NULL, 0, min_t(unsigned long, U32_MAX - 1, INT_MAX), GFP_NOWAIT); if (ret >= 0) uobj->id = ret; - spin_unlock(&uobj->context->ufile->idr_lock); + spin_unlock(&uobj->ufile->idr_lock); idr_preload_end(); return ret < 0 ? ret : 0; @@ -204,9 +204,9 @@ static int idr_add_uobj(struct ib_uobject *uobj) */ static void uverbs_idr_remove_uobj(struct ib_uobject *uobj) { - spin_lock(&uobj->context->ufile->idr_lock); - idr_remove(&uobj->context->ufile->idr, uobj->id); - spin_unlock(&uobj->context->ufile->idr_lock); + spin_lock(&uobj->ufile->idr_lock); + idr_remove(&uobj->ufile->idr, uobj->id); + spin_unlock(&uobj->ufile->idr_lock); } /* Returns the ib_uobject or an error. The caller should check for IS_ERR. */ @@ -519,14 +519,13 @@ out: static void alloc_commit_idr_uobject(struct ib_uobject *uobj) { - spin_lock(&uobj->context->ufile->idr_lock); + spin_lock(&uobj->ufile->idr_lock); /* * We already allocated this IDR with a NULL object, so * this shouldn't fail. */ - WARN_ON(idr_replace(&uobj->context->ufile->idr, - uobj, uobj->id)); - spin_unlock(&uobj->context->ufile->idr_lock); + WARN_ON(idr_replace(&uobj->ufile->idr, uobj, uobj->id)); + spin_unlock(&uobj->ufile->idr_lock); } static void alloc_commit_fd_uobject(struct ib_uobject *uobj) |