staging: mrst: ossync: Execute sync callbacks outside the spinlock
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 22 Dec 2011 15:19:44 +0000 (17:19 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:13 +0000 (12:29 +0300)
No need to hold the spinlock while executing the sync callbacks.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
drivers/staging/mrst/pvr/services4/srvkm/env/linux/ossync.c

index 3f80ba4..b555b00 100644 (file)
@@ -104,19 +104,25 @@ PVRSRVCheckPendingSyncs()
 {
        struct pending_sync *ps, *tmp;
        unsigned long flags;
+       LIST_HEAD(completed_list);
 
+       /* Pull the completed objects from the list. */
        spin_lock_irqsave(&sync_lock, flags);
 
        list_for_each_entry_safe(ps, tmp, &sync_list, list) {
                if (pending_ops_completed(ps->sync_info, ps->flags,
                                          ps->pending_read_ops,
                                          ps->pending_write_ops)) {
-                       ps->callback(ps->user_data);
-                       list_del(&ps->list);
-                       kfree(ps);
+                       list_move_tail(&ps->list, &completed_list);
                }
        }
 
        spin_unlock_irqrestore(&sync_lock, flags);
+
+       /* Execute the callbacks */
+       list_for_each_entry_safe(ps, tmp, &completed_list, list) {
+               ps->callback(ps->user_data);
+               kfree(ps);
+       }
 }