patch-2.1.127 linux/drivers/sound/sequencer.c

Next file: linux/drivers/sound/sgalaxy.c
Previous file: linux/drivers/sound/msnd_pinnacle.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.126/linux/drivers/sound/sequencer.c linux/drivers/sound/sequencer.c
@@ -113,9 +113,9 @@
   			restore_flags(flags);
   			return -EAGAIN;
   		}
- 		current->timeout = pre_event_timeout ? jiffies + pre_event_timeout : 0;
- 		interruptible_sleep_on(&midi_sleeper);
- 		current->timeout = 0;
+
+ 		interruptible_sleep_on_timeout(&midi_sleeper,
+					       pre_event_timeout);
 		if (!iqlen)
 		{
 			restore_flags(flags);
@@ -355,7 +355,6 @@
 		/*
 		 * Sleep until there is enough space on the queue
 		 */
-		current->timeout = 0;
 		interruptible_sleep_on(&seq_sleeper);
 	}
 	if (qlen >= SEQ_MAX_QUEUE)
@@ -1026,7 +1025,7 @@
 
 	max_mididev = num_midis;
 	max_synthdev = num_synths;
-	pre_event_timeout = 0;
+	pre_event_timeout = MAX_SCHEDULE_TIMEOUT;
 	seq_mode = SEQ_1;
 
 	if (pending_timer != -1)
@@ -1153,11 +1152,9 @@
 		 * Let's have a delay
 		 */
 
- 		if (n) {
- 			current->timeout = jiffies + HZ / 10;
- 			interruptible_sleep_on(&seq_sleeper);
- 			current->timeout = 0;
-  		}
+ 		if (n)
+ 			interruptible_sleep_on_timeout(&seq_sleeper,
+						       HZ/10);
 	}
 }
 
@@ -1179,9 +1176,8 @@
 		while (!signal_pending(current) && qlen > 0)
 		{
   			seq_sync();
- 			current->timeout = jiffies + 3 * HZ;
- 			interruptible_sleep_on(&seq_sleeper);
- 			current->timeout = 0;
+ 			interruptible_sleep_on_timeout(&seq_sleeper,
+						       3*HZ);
  			/* Extra delay */
 		}
 	}
@@ -1233,11 +1229,8 @@
 
 	save_flags(flags);
 	cli();
- 	if (qlen > 0) {
- 		current->timeout = jiffies + HZ;
- 		interruptible_sleep_on(&seq_sleeper);
- 		current->timeout = 0;
-  	}
+ 	if (qlen > 0)
+ 		interruptible_sleep_on_timeout(&seq_sleeper, HZ);
 	restore_flags(flags);
 	return qlen;
 }
@@ -1262,9 +1255,7 @@
 	save_flags(flags);
 	cli();
  	while (n && !midi_devs[dev]->outputc(dev, data)) {
- 		current->timeout = jiffies + 4;
- 		interruptible_sleep_on(&seq_sleeper);
- 		current->timeout = 0;
+ 		interruptible_sleep_on_timeout(&seq_sleeper, HZ/25);
   		n--;
   	}
 	restore_flags(flags);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov