patch-1.3.58 linux/drivers/sound/gus_midi.c

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

diff -u --recursive --new-file v1.3.57/linux/drivers/sound/gus_midi.c linux/drivers/sound/gus_midi.c
@@ -29,11 +29,9 @@
 
 #include "sound_config.h"
 
-#ifdef CONFIGURE_SOUNDCARD
-
 #include "gus_hw.h"
 
-#if !defined(EXCLUDE_GUS) && !defined(EXCLUDE_MIDI)
+#if defined(CONFIG_GUS) && defined(CONFIG_MIDI)
 
 static int      midi_busy = 0, input_opened = 0;
 static int      my_dev;
@@ -75,14 +73,8 @@
       input_opened = 1;
     }
 
-  if (mode == OPEN_WRITE || mode == OPEN_READWRITE)
-    {
-      gus_midi_control |= MIDI_ENABLE_XMIT;
-    }
 
-  outb (gus_midi_control, u_MidiControl);	/*
-						   * Enable
-						 */
+  outb (gus_midi_control, u_MidiControl);	/* Enable */
 
   midi_busy = 1;
   qlen = qhead = qtail = output_used = 0;
@@ -276,37 +268,37 @@
   save_flags (flags);
   cli ();
 
-  stat = GUS_MIDI_STATUS ();
-
-  if (stat & MIDI_RCV_FULL)
+  while ((stat = GUS_MIDI_STATUS ()) & (MIDI_RCV_FULL | MIDI_XMIT_EMPTY))
     {
-      data = inb (u_MidiData);
-      if (input_opened)
-	midi_input_intr (my_dev, data);
-    }
-
-  if (stat & MIDI_XMIT_EMPTY)
-    {
-      while (qlen && dump_to_midi (tmp_queue[qhead]))
+      if (stat & MIDI_RCV_FULL)
 	{
-	  qlen--;
-	  qhead++;
+	  data = inb (u_MidiData);
+	  if (input_opened)
+	    midi_input_intr (my_dev, data);
 	}
 
-      if (!qlen)
+      if (stat & MIDI_XMIT_EMPTY)
 	{
-	  /*
-	   * Disable Midi output interrupts, since no data in the buffer
-	   */
-	  gus_midi_control &= ~MIDI_ENABLE_XMIT;
-	  outb (gus_midi_control, u_MidiControl);
+	  while (qlen && dump_to_midi (tmp_queue[qhead]))
+	    {
+	      qlen--;
+	      qhead++;
+	    }
+
+	  if (!qlen)
+	    {
+	      /*
+	       * Disable Midi output interrupts, since no data in the buffer
+	       */
+	      gus_midi_control &= ~MIDI_ENABLE_XMIT;
+	      outb (gus_midi_control, u_MidiControl);
+	      outb (gus_midi_control, u_MidiControl);
+	    }
 	}
-    }
 
+    }
 
   restore_flags (flags);
 }
-
-#endif
 
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this