diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-02-25 12:59:52 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 14:00:15 +0400 |
commit | ea6b5828cdbbedaf26b12ae64befbec18084ea3c (patch) | |
tree | 5a02e041c96c4ec34c574c90b8b094935c03dfb4 /sound | |
parent | 47ba97f8fa01bb5b48e73b4b1271fbf1436a2d4b (diff) | |
download | linux-ea6b5828cdbbedaf26b12ae64befbec18084ea3c.tar.xz |
[ALSA] mpu401: reduce tx loop timeout
Reduce the number of times to check for a non-empty Tx FIFO from 100 to
2 because there is no MPU-401 implementation that needs more than one or
two reads to determine the actual FIFO status.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/drivers/mpu401/mpu401_uart.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 5993864acbd3..dd6ec4266732 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -425,16 +425,17 @@ static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu) static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu) { unsigned char byte; - int max = 256, timeout; + int max = 256; do { if (snd_rawmidi_transmit_peek(mpu->substream_output, &byte, 1) == 1) { - for (timeout = 100; timeout > 0; timeout--) { - if (snd_mpu401_output_ready(mpu)) - break; - } - if (timeout == 0) + /* + * Try twice because there is hardware that insists on + * setting the output busy bit after each write. + */ + if (!snd_mpu401_output_ready(mpu) && + !snd_mpu401_output_ready(mpu)) break; /* Tx FIFO full - try again later */ mpu->write(mpu, byte, MPU401D(mpu)); snd_rawmidi_transmit_ack(mpu->substream_output, 1); |