diff options
author | Sean Hefty <sean.hefty@intel.com> | 2007-04-05 13:49:51 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-04-24 19:31:11 -0400 |
commit | d92f76448c1a3e40ff3df96a653ecd83aeac6ee7 (patch) | |
tree | 4a1674c45cb1d4c4bee4e6f52f39b7b9a8b9aca1 /drivers/infiniband/core | |
parent | 30c00986f3a610cdcee2602b8254c3ffa6cddc04 (diff) |
RDMA/ucma: Simplify ucma_get_event()
Use wait_event_interruptible() instead of a more complicated
open-coded equivalent.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/ucma.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index c859134c1daa..53b4c94a7eb5 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c | |||
@@ -306,26 +306,18 @@ static ssize_t ucma_get_event(struct ucma_file *file, const char __user *inbuf, | |||
306 | 306 | ||
307 | mutex_lock(&file->mut); | 307 | mutex_lock(&file->mut); |
308 | while (list_empty(&file->event_list)) { | 308 | while (list_empty(&file->event_list)) { |
309 | if (file->filp->f_flags & O_NONBLOCK) { | 309 | mutex_unlock(&file->mut); |
310 | ret = -EAGAIN; | ||
311 | break; | ||
312 | } | ||
313 | 310 | ||
314 | if (signal_pending(current)) { | 311 | if (file->filp->f_flags & O_NONBLOCK) |
315 | ret = -ERESTARTSYS; | 312 | return -EAGAIN; |
316 | break; | 313 | |
317 | } | 314 | if (wait_event_interruptible(file->poll_wait, |
315 | !list_empty(&file->event_list))) | ||
316 | return -ERESTARTSYS; | ||
318 | 317 | ||
319 | prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE); | ||
320 | mutex_unlock(&file->mut); | ||
321 | schedule(); | ||
322 | mutex_lock(&file->mut); | 318 | mutex_lock(&file->mut); |
323 | finish_wait(&file->poll_wait, &wait); | ||
324 | } | 319 | } |
325 | 320 | ||
326 | if (ret) | ||
327 | goto done; | ||
328 | |||
329 | uevent = list_entry(file->event_list.next, struct ucma_event, list); | 321 | uevent = list_entry(file->event_list.next, struct ucma_event, list); |
330 | 322 | ||
331 | if (uevent->resp.event == RDMA_CM_EVENT_CONNECT_REQUEST) { | 323 | if (uevent->resp.event == RDMA_CM_EVENT_CONNECT_REQUEST) { |