aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2006-09-22 18:17:19 -0400
committerRoland Dreier <rolandd@cisco.com>2006-09-22 18:17:19 -0400
commitab10867621a96230757eb4a2a19d560b85f62ce9 (patch)
treef8dc75cf9222948663ce01b819764cd8d332d6d9 /drivers
parent9217b27b12eb5ab910d14b3376c2b6cd13d87711 (diff)
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: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 30923eb68ec7..b81307b625a6 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -894,7 +894,6 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
894{ 894{
895 struct ib_uverbs_poll_cq cmd; 895 struct ib_uverbs_poll_cq cmd;
896 struct ib_uverbs_poll_cq_resp *resp; 896 struct ib_uverbs_poll_cq_resp *resp;
897 struct ib_uobject *uobj;
898 struct ib_cq *cq; 897 struct ib_cq *cq;
899 struct ib_wc *wc; 898 struct ib_wc *wc;
900 int ret = 0; 899 int ret = 0;
@@ -915,16 +914,15 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,
915 goto out_wc; 914 goto out_wc;
916 } 915 }
917 916
918 uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext); 917 cq = idr_read_cq(cmd.cq_handle, file->ucontext);
919 if (!uobj) { 918 if (!cq) {
920 ret = -EINVAL; 919 ret = -EINVAL;
921 goto out; 920 goto out;
922 } 921 }
923 cq = uobj->object;
924 922
925 resp->count = ib_poll_cq(cq, cmd.ne, wc); 923 resp->count = ib_poll_cq(cq, cmd.ne, wc);
926 924
927 put_uobj_read(uobj); 925 put_cq_read(cq);
928 926
929 for (i = 0; i < resp->count; i++) { 927 for (i = 0; i < resp->count; i++) {
930 resp->wc[i].wr_id = wc[i].wr_id; 928 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 int out_len) 957 int out_len)
960{ 958{
961 struct ib_uverbs_req_notify_cq cmd; 959 struct ib_uverbs_req_notify_cq cmd;
962 struct ib_uobject *uobj;
963 struct ib_cq *cq; 960 struct ib_cq *cq;
964 961
965 if (copy_from_user(&cmd, buf, sizeof cmd)) 962 if (copy_from_user(&cmd, buf, sizeof cmd))
966 return -EFAULT; 963 return -EFAULT;
967 964
968 uobj = idr_read_uobj(&ib_uverbs_cq_idr, cmd.cq_handle, file->ucontext); 965 cq = idr_read_cq(cmd.cq_handle, file->ucontext);
969 if (!uobj) 966 if (!cq)
970 return -EINVAL; 967 return -EINVAL;
971 cq = uobj->object;
972 968
973 ib_req_notify_cq(cq, cmd.solicited_only ? 969 ib_req_notify_cq(cq, cmd.solicited_only ?
974 IB_CQ_SOLICITED : IB_CQ_NEXT_COMP); 970 IB_CQ_SOLICITED : IB_CQ_NEXT_COMP);
975 971
976 put_uobj_read(uobj); 972 put_cq_read(cq);
977 973
978 return in_len; 974 return in_len;
979} 975}