Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9d41b7fdeadb76bd4d06c16803daffd9fcf8dc7f
Commit:     9d41b7fdeadb76bd4d06c16803daffd9fcf8dc7f
Parent:     d92f76448c1a3e40ff3df96a653ecd83aeac6ee7
Author:     Sean Hefty <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 5 10:51:05 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Apr 24 16:31:11 2007 -0700

    IB/ucm: Simplify ib_ucm_event()
    
    Use wait_event_interruptible() instead of a more complicated
    open-coded equivalent.
    
    Signed-off-by: Sean Hefty <[EMAIL PROTECTED]>
---
 drivers/infiniband/core/ucm.c |   23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index ee51d79..2586a3e 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -407,29 +407,18 @@ static ssize_t ib_ucm_event(struct ib_ucm_file *file,
 
        mutex_lock(&file->file_mutex);
        while (list_empty(&file->events)) {
+               mutex_unlock(&file->file_mutex);
 
-               if (file->filp->f_flags & O_NONBLOCK) {
-                       result = -EAGAIN;
-                       break;
-               }
+               if (file->filp->f_flags & O_NONBLOCK)
+                       return -EAGAIN;
 
-               if (signal_pending(current)) {
-                       result = -ERESTARTSYS;
-                       break;
-               }
+               if (wait_event_interruptible(file->poll_wait,
+                                            !list_empty(&file->events)))
+                       return -ERESTARTSYS;
 
-               prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE);
-
-               mutex_unlock(&file->file_mutex);
-               schedule();
                mutex_lock(&file->file_mutex);
-
-               finish_wait(&file->poll_wait, &wait);
        }
 
-       if (result)
-               goto done;
-
        uevent = list_entry(file->events.next, struct ib_ucm_event, file_list);
 
        if (ib_ucm_new_cm_id(uevent->resp.event)) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to