Commit ab108676 authored by Roland Dreier's avatar Roland Dreier

IB/uverbs: Use idr_read_cq() where appropriate

There were two functions that open-coded idr_read_cq() in terms of
idr_read_uobj() rather than using the helper.
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 9217b27b
...@@ -894,7 +894,6 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, ...@@ -894,7 +894,6 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
{ {
struct ib_uverbs_poll_cq cmd; struct ib_uverbs_poll_cq cmd;
struct ib_uverbs_poll_cq_resp *resp; struct ib_uverbs_poll_cq_resp *resp;
struct ib_uobject *uobj;
struct ib_cq *cq; struct ib_cq *cq;
struct ib_wc *wc; struct ib_wc *wc;
int ret = 0; int ret = 0;
...@@ -915,16 +914,15 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, ...@@ -915,16 +914,15 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
goto out_wc; goto out_wc;
} }
uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext); cq = idr_read_cq(cmd.cq_handle, file->ucontext);
if (!uobj) { if (!cq) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
cq = uobj->object;
resp->count = ib_poll_cq(cq, cmd.ne, wc); resp->count = ib_poll_cq(cq, cmd.ne, wc);
put_uobj_read(uobj); put_cq_read(cq);
for (i = 0; i < resp->count; i++) { for (i = 0; i < resp->count; i++) {
resp->wc[i].wr_id = wc[i].wr_id; resp->wc[i].wr_id = wc[i].wr_id;
...@@ -959,21 +957,19 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, ...@@ -959,21 +957,19 @@ ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file,
int out_len) int out_len)
{ {
struct ib_uverbs_req_notify_cq cmd; struct ib_uverbs_req_notify_cq cmd;
struct ib_uobject *uobj;
struct ib_cq *cq; struct ib_cq *cq;
if (copy_from_user(&cmd, buf, sizeof cmd)) if (copy_from_user(&cmd, buf, sizeof cmd))
return -EFAULT; return -EFAULT;
uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext); cq = idr_read_cq(cmd.cq_handle, file->ucontext);
if (!uobj) if (!cq)
return -EINVAL; return -EINVAL;
cq = uobj->object;
ib_req_notify_cq(cq, cmd.solicited_only ? ib_req_notify_cq(cq, cmd.solicited_only ?
IB_CQ_SOLICITED : IB_CQ_NEXT_COMP); IB_CQ_SOLICITED : IB_CQ_NEXT_COMP);
put_uobj_read(uobj); put_cq_read(cq);
return in_len; return in_len;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment