DORMANTno replies

[PATCH 1 of 3][ATM]: [horizon] replace interruptible_sleep_on() with wait_event_interruptible()

From: chas williams - CONTRACTOR <hidden>
Date: 2005-02-04 18:23:07

please apply to 2.6.

thanks!

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/02/03 11:38:49-05:00 chas@relax.cmf.nrl.navy.mil 
#   [ATM]: [horizon] replace interruptible_sleep_on() with wait_event_interruptible()
#   
#     Signed-off-by: Nishanth Aravamudan [off-list ref]
#     Signed-off-by: Chas Williams [off-list ref]
# 
# drivers/atm/horizon.c
#   2005/02/03 11:38:31-05:00 chas@relax.cmf.nrl.navy.mil +6 -7
#   [ATM]: [horizon] replace interruptible_sleep_on() with wait_event_interruptible()
#   
#     Signed-off-by: Nishanth Aravamudan [off-list ref]
#     Signed-off-by: Chas Williams [off-list ref]
# 
diff -Nru a/drivers/atm/horizon.c b/drivers/atm/horizon.c
--- a/drivers/atm/horizon.c	2005-02-03 12:17:39 -05:00
+++ b/drivers/atm/horizon.c	2005-02-03 12:17:39 -05:00
@@ -39,6 +39,7 @@
 #include <linux/uio.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
+#include <linux/wait.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -1089,13 +1090,11 @@
 /********** (queue to) become the next TX thread **********/
 
 static inline int tx_hold (hrz_dev * dev) {
-  while (test_and_set_bit (tx_busy, &dev->flags)) {
-    PRINTD (DBG_TX, "sleeping at tx lock %p %lu", dev, dev->flags);
-    interruptible_sleep_on (&dev->tx_queue);
-    PRINTD (DBG_TX, "woken at tx lock %p %lu", dev, dev->flags);
-    if (signal_pending (current))
-      return -1;
-  }
+  PRINTD (DBG_TX, "sleeping at tx lock %p %lu", dev, dev->flags);
+  wait_event_interruptible(dev->tx_queue, (!test_and_set_bit(tx_busy, &dev->flags)));
+  PRINTD (DBG_TX, "woken at tx lock %p %lu", dev, dev->flags);
+  if (signal_pending (current))
+    return -1;
   PRINTD (DBG_TX, "set tx_busy for dev %p", dev);
   return 0;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help