[patch 4/6] net/lanstreamer: replace interruptible_sleep_on_timeout() with wait_event_interruptible_timeout()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nishanth Aravamudan <nacc@xxxxxxxxxx>



Use wait_event_interruptible_timeout() instead of the
deprecated interruptible_sleep_on_timeout(). Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@xxxxxxxxxx>
Signed-off-by: Domen Puncer <domen@xxxxxxxxxxxx>
---
 lanstreamer.c |   44 +++++++++++++++++++-------------------------
 1 files changed, 19 insertions(+), 25 deletions(-)

Index: quilt/drivers/net/tokenring/lanstreamer.c
===================================================================
--- quilt.orig/drivers/net/tokenring/lanstreamer.c
+++ quilt/drivers/net/tokenring/lanstreamer.c
@@ -121,6 +121,7 @@
 #include <linux/spinlock.h>
 #include <linux/version.h>
 #include <linux/bitops.h>
+#include <linux/wait.h>
 
 #include <net/checksum.h>
 
@@ -669,17 +670,15 @@ static int streamer_open(struct net_devi
 		writew(LISR_SRB_CMD, streamer_mmio + LISR_SUM);
 		spin_unlock_irqrestore(&streamer_priv->streamer_lock, flags);
 
-		while (streamer_priv->srb_queued) {
-			interruptible_sleep_on_timeout(&streamer_priv->srb_wait, 5 * HZ);
-			if (signal_pending(current)) {
-				printk(KERN_WARNING "%s: SRB timed out.\n", dev->name);
-				printk(KERN_WARNING "SISR=%x MISR=%x, LISR=%x\n",
-				       readw(streamer_mmio + SISR),
-				       readw(streamer_mmio + MISR_RUM),
-				       readw(streamer_mmio + LISR));
-				streamer_priv->srb_queued = 0;
-				break;
-			}
+		wait_event_interruptible_timeout(streamer_priv->srb_wait,
+				!streamer_priv->srb_queued, 5 * HZ);
+		if (signal_pending(current)) {
+			printk(KERN_WARNING "%s: SRB timed out.\n", dev->name);
+			printk(KERN_WARNING "SISR=%x MISR=%x, LISR=%x\n",
+			       readw(streamer_mmio + SISR),
+			       readw(streamer_mmio + MISR_RUM),
+			       readw(streamer_mmio + LISR));
+			streamer_priv->srb_queued = 0;
 		}
 
 #if STREAMER_DEBUG
@@ -1223,20 +1222,15 @@ static int streamer_close(struct net_dev
 
 	spin_unlock_irqrestore(&streamer_priv->streamer_lock, flags);
 
-	while (streamer_priv->srb_queued) 
-	{
-		interruptible_sleep_on_timeout(&streamer_priv->srb_wait,
-					       jiffies + 60 * HZ);
-		if (signal_pending(current)) 
-		{
-			printk(KERN_WARNING "%s: SRB timed out.\n", dev->name);
-			printk(KERN_WARNING "SISR=%x MISR=%x LISR=%x\n",
-			       readw(streamer_mmio + SISR),
-			       readw(streamer_mmio + MISR_RUM),
-			       readw(streamer_mmio + LISR));
-			streamer_priv->srb_queued = 0;
-			break;
-		}
+	wait_event_interruptible_timeout(streamer_priv->srb_wait,
+			!streamer_priv->srb_queued, 60*HZ);
+	if (signal_pending(current)) {
+		printk(KERN_WARNING "%s: SRB timed out.\n", dev->name);
+		printk(KERN_WARNING "SISR=%x MISR=%x LISR=%x\n",
+		       readw(streamer_mmio + SISR),
+		       readw(streamer_mmio + MISR_RUM),
+		       readw(streamer_mmio + LISR));
+		streamer_priv->srb_queued = 0;
 	}
 
 	streamer_priv->rx_ring_last_received = (streamer_priv->rx_ring_last_received + 1) & (STREAMER_RX_RING_SIZE - 1);

--
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux