tegra: video: host: fix race condition in hostintr wait list
Varun Wadekar [Tue, 23 Nov 2010 14:33:02 +0000 (19:33 +0530)]
Change-Id: I5e58f5fe8935741441e2b30f585bb997b6317d3d
Author: Alex Frid <afrid@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>

drivers/video/tegra/host/nvhost_intr.c

index 848d8b1..007aaed 100644 (file)
@@ -178,8 +178,7 @@ static void run_handlers(struct list_head completed[NVHOST_INTR_ACTION_COUNT])
                list_for_each_entry_safe(waiter, next, head, list) {
                        list_del(&waiter->list);
                        handler(waiter);
-                       atomic_set(&waiter->state, WLS_HANDLED);
-                       smp_wmb();
+                       WARN_ON(atomic_xchg(&waiter->state, WLS_HANDLED) != WLS_REMOVED);
                        kref_put(&waiter->refcount, waiter_release);
                }
        }