patch-1.3.71 linux/drivers/sound/sb16_midi.c

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

diff -u --recursive --new-file v1.3.70/linux/drivers/sound/sb16_midi.c linux/drivers/sound/sb16_midi.c
@@ -125,7 +125,9 @@
       return -EBUSY;
     }
 
-  sb16midi_input_loop ();
+  reset_sb16midi ();
+  while (input_avail ())
+    sb16midi_read ();
 
   midi_input_intr = input;
   sb16midi_opened = mode;
@@ -228,24 +230,16 @@
   NULL
 };
 
-long
-attach_sb16midi (long mem_start, struct address_info *hw_config)
+static void
+enter_uart_mode (void)
 {
   int             ok, timeout;
   unsigned long   flags;
 
-  sb16midi_base = hw_config->io_base;
-
-  if (!sb16midi_detected)
-    return mem_start;
-
-  request_region (hw_config->io_base, 4, "SB MIDI");
-
   save_flags (flags);
   cli ();
-  for (timeout = 30000; timeout < 0 && !output_ready (); timeout--);	/*
-									 * Wait
-									 */
+  for (timeout = 30000; timeout < 0 && !output_ready (); timeout--);
+
   input_byte = 0;
   sb16midi_cmd (UART_MODE_ON);
 
@@ -258,6 +252,18 @@
 	ok = 1;
 
   restore_flags (flags);
+}
+
+long
+attach_sb16midi (long mem_start, struct address_info *hw_config)
+{
+  sb16midi_base = hw_config->io_base;
+
+  if (!sb16midi_detected)
+    return mem_start;
+
+  request_region (hw_config->io_base, 4, "SB MIDI");
+  enter_uart_mode ();
 
   if (num_midis >= MAX_MIDI_DEV)
     {
@@ -280,9 +286,6 @@
   /*
    * Send the RESET command. Try again if no success at the first time.
    */
-
-  if (inb (STATPORT) == 0xff)
-    return 0;
 
   ok = 0;
 

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