[MIPS] RTLX: Don't use volatile; it's fragile.
authorRalf Baechle <ralf@linux-mips.org>
Thu, 15 Mar 2007 17:08:28 +0000 (17:08 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Sat, 17 Mar 2007 01:03:27 +0000 (01:03 +0000)
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/rtlx.c

index e14ae09eda2b7a94dd4d264bd9d0b7c864380811..16d3fdecf3eaf083d71db2725146f154285e372b 100644 (file)
@@ -146,7 +146,7 @@ static void stopping(int vpe)
 
 int rtlx_open(int index, int can_sleep)
 {
-       volatile struct rtlx_info **p;
+       struct rtlx_info **p;
        struct rtlx_channel *chan;
        enum rtlx_state state;
        int ret = 0;
@@ -179,13 +179,24 @@ int rtlx_open(int index, int can_sleep)
                        }
                }
 
+               smp_rmb();
                if (*p == NULL) {
                        if (can_sleep) {
-                               __wait_event_interruptible(channel_wqs[index].lx_queue,
-                                                          *p != NULL,
-                                                          ret);
-                               if (ret)
+                               DEFINE_WAIT(wait);
+
+                               for (;;) {
+                                       prepare_to_wait(&channel_wqs[index].lx_queue, &wait, TASK_INTERRUPTIBLE);
+                                       smp_rmb();
+                                       if (*p != NULL)
+                                               break;
+                                       if (!signal_pending(current)) {
+                                               schedule();
+                                               continue;
+                                       }
+                                       ret = -ERESTARTSYS;
                                        goto out_fail;
+                               }
+                               finish_wait(&channel_wqs[index].lx_queue, &wait);
                        } else {
                                printk(" *vpe_get_shared is NULL. "
                                       "Has an SP program been loaded?\n");