patch-2.4.10 linux/drivers/sound/ymfpci.c

Next file: linux/drivers/tc/lk201-map.map
Previous file: linux/drivers/sound/wavfront.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/drivers/sound/ymfpci.c linux/drivers/sound/ymfpci.c
@@ -457,11 +457,12 @@
 	}
 #endif
 
+	set_current_state(TASK_UNINTERRUPTIBLE);
 	while (ypcm->running) {
 		spin_unlock_irqrestore(&unit->reg_lock, flags);
-		set_current_state(TASK_UNINTERRUPTIBLE);
 		schedule();
 		spin_lock_irqsave(&unit->reg_lock, flags);
+		set_current_state(TASK_UNINTERRUPTIBLE);
 	}
 	spin_unlock_irqrestore(&unit->reg_lock, flags);
 
@@ -1198,12 +1199,13 @@
 	ret = 0;
 
 	add_wait_queue(&dmabuf->wait, &waita);
+	set_current_state(TASK_INTERRUPTIBLE);
 	while (count > 0) {
 		spin_lock_irqsave(&unit->reg_lock, flags);
 		if (unit->suspended) {
 			spin_unlock_irqrestore(&unit->reg_lock, flags);
-			set_current_state(TASK_INTERRUPTIBLE);
 			schedule();
+			set_current_state(TASK_INTERRUPTIBLE);
 			if (signal_pending(current)) {
 				if (!ret) ret = -EAGAIN;
 				break;
@@ -1241,9 +1243,9 @@
 			   is TOO LATE for the process to be scheduled to run (scheduler latency)
 			   which results in a (potential) buffer overrun. And worse, there is
 			   NOTHING we can do to prevent it. */
-			set_current_state(TASK_INTERRUPTIBLE);
 			tmo = schedule_timeout(tmo);
 			spin_lock_irqsave(&state->unit->reg_lock, flags);
+			set_current_state(TASK_INTERRUPTIBLE);
 			if (tmo == 0 && dmabuf->count == 0) {
 				printk(KERN_ERR "ymfpci%d: recording schedule timeout, "
 				    "dmasz %u fragsz %u count %i hwptr %u swptr %u\n",
@@ -1326,12 +1328,13 @@
 	redzone *= 3;	/* 2 redzone + 1 possible uncertainty reserve. */
 
 	add_wait_queue(&dmabuf->wait, &waita);
+	set_current_state(TASK_INTERRUPTIBLE);
 	while (count > 0) {
 		spin_lock_irqsave(&unit->reg_lock, flags);
 		if (unit->suspended) {
 			spin_unlock_irqrestore(&unit->reg_lock, flags);
-			set_current_state(TASK_INTERRUPTIBLE);
 			schedule();
+			set_current_state(TASK_INTERRUPTIBLE);
 			if (signal_pending(current)) {
 				if (!ret) ret = -EAGAIN;
 				break;
@@ -1389,8 +1392,8 @@
 				if (!ret) ret = -EAGAIN;
 				break;
 			}
-			set_current_state(TASK_INTERRUPTIBLE);
 			schedule();
+			set_current_state(TASK_INTERRUPTIBLE);
 			if (signal_pending(current)) {
 				if (!ret) ret = -ERESTARTSYS;
 				break;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)