summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-07-04 11:32:08 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-07-09 11:26:17 -0600
commit6ef1c82821b2ae9bfa26fe65e6f0a66dfd79b7d7 (patch)
tree7025f260eec5f1fdb10baa1e24e27cd8052bcd19 /drivers/infiniband/core/uverbs_main.c
parent6a5e9c88419828a487204e35291ae4459697a9bd (diff)
downloadlinux-6ef1c82821b2ae9bfa26fe65e6f0a66dfd79b7d7.tar.gz
linux-6ef1c82821b2ae9bfa26fe65e6f0a66dfd79b7d7.tar.bz2
linux-6ef1c82821b2ae9bfa26fe65e6f0a66dfd79b7d7.zip
IB/uverbs: Replace ib_ucontext with ib_uverbs_file in core function calls
The correct handle to refer to the idr/etc is ib_uverbs_file, revise all the core APIs to use this instead. The user API are left as wrappers that automatically convert a ucontext to a ufile for now. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/uverbs_main.c')
-rw-r--r--drivers/infiniband/core/uverbs_main.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 82168b53e2ae..037c8975d9f0 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -227,12 +227,13 @@ void ib_uverbs_detach_umcast(struct ib_qp *qp,
}
}
-static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
- struct ib_ucontext *context,
- bool device_removed)
+static int ib_uverbs_cleanup_ufile(struct ib_uverbs_file *file,
+ bool device_removed)
{
+ struct ib_ucontext *context = file->ucontext;
+
context->closing = 1;
- uverbs_cleanup_ucontext(context, device_removed);
+ uverbs_cleanup_ufile(file, device_removed);
put_pid(context->tgid);
ib_rdmacg_uncharge(&context->cg_obj, context->device,
@@ -918,7 +919,7 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp)
mutex_lock(&file->cleanup_mutex);
if (file->ucontext) {
- ib_uverbs_cleanup_ucontext(file, file->ucontext, false);
+ ib_uverbs_cleanup_ufile(file, false);
file->ucontext = NULL;
}
mutex_unlock(&file->cleanup_mutex);
@@ -1176,7 +1177,7 @@ static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev,
mutex_unlock(&file->cleanup_mutex);
/* At this point ib_uverbs_close cannot be running
- * ib_uverbs_cleanup_ucontext
+ * ib_uverbs_cleanup_ufile
*/
if (ucontext) {
/* We must release the mutex before going ahead and
@@ -1188,7 +1189,7 @@ static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev,
ib_uverbs_event_handler(&file->event_handler, &event);
ib_uverbs_disassociate_ucontext(ucontext);
mutex_lock(&file->cleanup_mutex);
- ib_uverbs_cleanup_ucontext(file, ucontext, true);
+ ib_uverbs_cleanup_ufile(file, true);
mutex_unlock(&file->cleanup_mutex);
}