patch-2.1.110 linux/drivers/sound/msnd_classic.c

Next file: linux/drivers/sound/msnd_classic.h
Previous file: linux/drivers/sound/msnd.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.109/linux/drivers/sound/msnd_classic.c linux/drivers/sound/msnd_classic.c
@@ -453,8 +453,17 @@
 	mdelay(1);
 	if (test_and_clear_bit(F_WRITING, &dev.flags)) {
 
+		set_bit(F_WRITEFLUSH, &dev.flags);
+		interruptible_sleep_on(&dev.writeflush);
+		current->state = TASK_INTERRUPTIBLE;
+		current->timeout = 
+			jiffies + DAP_BUFF_SIZE / 2 * HZ /
+			dev.sample_rate / dev.channels;
+		schedule();
+		current->timeout = 0;
 		msnd_send_dsp_cmd(&dev, HDEX_PLAY_STOP);
 		msnd_disable_irq(&dev);
+		memset_io(dev.base, 0, DAP_BUFF_SIZE * 3);
 
 	}
 	mdelay(1);
@@ -674,8 +683,9 @@
 			} 
 			else if (!test_bit(F_WRITEBLOCK, &dev.flags)) {
 
-				memset_io(dev.base, 0, DAP_BUFF_SIZE * 3);
 				clear_bit(F_WRITING, &dev.flags);
+				if (test_and_clear_bit(F_WRITEFLUSH, &dev.flags))
+					wake_up_interruptible(&dev.writeflush);
 				msnd_disable_irq(&dev);
 
 			}
@@ -728,7 +738,7 @@
 			break;
 
 		default:
-			printk(KERN_INFO LOGNAME ": DSP message %u\n", LOBYTE(wMessage));
+			printk(KERN_DEBUG LOGNAME ": DSP message %u\n", LOBYTE(wMessage));
 			break;
 		}
 		break;
@@ -738,15 +748,19 @@
 			(*dev.midi_in_interrupt)(&dev);
 		break;
 
+	case HIMT_MIDI_OUT:
+		printk(KERN_DEBUG LOGNAME ": MIDI out event\n");
+		break;
+
 	default:
+		printk(KERN_DEBUG LOGNAME ": HIMT message %u\n", HIBYTE(wMessage));
 		break;
 	}
 }
 
 static void intr(int irq, void *dev_id, struct pt_regs *regs)
 {
-	if (test_bit(F_INTERRUPT, &dev.flags) || 
-	    ((multisound_dev_t *)dev_id != &dev))
+	if (test_bit(F_INTERRUPT, &dev.flags))
 		return;
 
 	set_bit(F_INTERRUPT, &dev.flags);
@@ -1261,6 +1275,7 @@
 
 	init_waitqueue(&dev.writeblock);
 	init_waitqueue(&dev.readblock);
+	init_waitqueue(&dev.writeflush);
 	msnd_fifo_init(&dev.DAPF);
 	msnd_fifo_init(&dev.DARF);
 	spin_lock_init(&dev.lock);

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