All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MPU-401 fixes
@ 2003-05-05  6:33 Clemens Ladisch
  2003-05-05 10:32 ` Jaroslav Kysela
  0 siblings, 1 reply; 11+ messages in thread
From: Clemens Ladisch @ 2003-05-05  6:33 UTC (permalink / raw)
  To: alsa-devel


- fix deadlock: when snd_mpu401_uart_input_trigger() is interrupted
  immediately after the call to spin_unlock_irqrestore(), the interrupt
  handler won't clear the interrupt condition because the RX_LOOP bit is
  still set
- abort the tx loop when the FIFO is full; otherwise, the inner loop would
  be executed 25600 times
- clear the output trigger bit when output buffer is exhausted


Index: alsa-kernel/drivers/mpu401/mpu401_uart.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/drivers/mpu401/mpu401_uart.c,v
retrieving revision 1.23
diff -u -r1.23 mpu401_uart.c
--- alsa-kernel/drivers/mpu401/mpu401_uart.c	23 Apr 2003 10:01:28 -0000	1.23
+++ alsa-kernel/drivers/mpu401/mpu401_uart.c	5 May 2003 06:28:02 -0000
@@ -93,12 +93,9 @@
 static void _snd_mpu401_uart_interrupt(mpu401_t *mpu)
 {
 	if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) {
-		if (! test_and_set_bit(MPU401_MODE_BIT_RX_LOOP, &mpu->mode)) {
-			spin_lock(&mpu->input_lock);
-			snd_mpu401_uart_input_read(mpu);
-			spin_unlock(&mpu->input_lock);
-			clear_bit(MPU401_MODE_BIT_RX_LOOP, &mpu->mode);
-		}
+		spin_lock(&mpu->input_lock);
+		snd_mpu401_uart_input_read(mpu);
+		spin_unlock(&mpu->input_lock);
 	} else
 		snd_mpu401_uart_clear_rx(mpu);
  	/* ok. for better Tx performance try do some output when input is done */
@@ -369,9 +366,12 @@
 					break;
 				}
 			}
+			if (timeout == 0)
+				break; /* Tx FIFO full - try again later */
 		} else {
 			snd_mpu401_uart_remove_timer (mpu, 0);
-			max = 1; /* no other data - leave the tx loop */
+			clear_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode);
+			break; /* no other data - leave the tx loop */
 		}
 	} while (--max > 0);
 }




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-05-07  9:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-05  6:33 [PATCH] MPU-401 fixes Clemens Ladisch
2003-05-05 10:32 ` Jaroslav Kysela
2003-05-05 11:19   ` Clemens Ladisch
2003-05-05 14:15     ` Takashi Iwai
2003-05-05 15:51       ` Clemens Ladisch
2003-05-06 11:33         ` Takashi Iwai
2003-05-06 15:09         ` Jaroslav Kysela
2003-05-06 16:33           ` Takashi Iwai
2003-05-07  7:56             ` Jaroslav Kysela
2003-05-07  8:31               ` Clemens Ladisch
2003-05-07  9:03                 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.