RDMA/ucma: Check that device exists prior to accessing it
[pandora-kernel.git] / kernel / async.c
index 4c2843c..009f516 100644 (file)
@@ -51,7 +51,7 @@ asynchronous and synchronous parts of the kernel.
 #include <linux/async.h>
 #include <linux/atomic.h>
 #include <linux/ktime.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/wait.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -88,6 +88,13 @@ static async_cookie_t  __lowest_in_progress(struct list_head *running)
 {
        struct async_entry *entry;
 
+       if (!running) { /* just check the entry count */
+               if (atomic_read(&entry_count))
+                       return 0; /* smaller than any cookie */
+               else
+                       return next_cookie;
+       }
+
        if (!list_empty(running)) {
                entry = list_first_entry(running,
                        struct async_entry, list);
@@ -238,9 +245,7 @@ EXPORT_SYMBOL_GPL(async_schedule_domain);
  */
 void async_synchronize_full(void)
 {
-       do {
-               async_synchronize_cookie(next_cookie);
-       } while (!list_empty(&async_running) || !list_empty(&async_pending));
+       async_synchronize_cookie_domain(next_cookie, NULL);
 }
 EXPORT_SYMBOL_GPL(async_synchronize_full);
 
@@ -260,7 +265,7 @@ EXPORT_SYMBOL_GPL(async_synchronize_full_domain);
 /**
  * async_synchronize_cookie_domain - synchronize asynchronous function calls within a certain domain with cookie checkpointing
  * @cookie: async_cookie_t to use as checkpoint
- * @running: running list to synchronize on
+ * @running: running list to synchronize on, NULL indicates all lists
  *
  * This function waits until all asynchronous function calls for the
  * synchronization domain specified by the running list @list submitted