diff options
Diffstat (limited to 'sound/drivers/mpu401')
-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) | |||
425 | static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu) | 425 | static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu) |
426 | { | 426 | { |
427 | unsigned char byte; | 427 | unsigned char byte; |
428 | int max = 256, timeout; | 428 | int max = 256; |
429 | 429 | ||
430 | do { | 430 | do { |
431 | if (snd_rawmidi_transmit_peek(mpu->substream_output, | 431 | if (snd_rawmidi_transmit_peek(mpu->substream_output, |
432 | &byte, 1) == 1) { | 432 | &byte, 1) == 1) { |
433 | for (timeout = 100; timeout > 0; timeout--) { | 433 | /* |
434 | if (snd_mpu401_output_ready(mpu)) | 434 | * Try twice because there is hardware that insists on |
435 | break; | 435 | * setting the output busy bit after each write. |
436 | } | 436 | */ |
437 | if (timeout == 0) | 437 | if (!snd_mpu401_output_ready(mpu) && |
438 | !snd_mpu401_output_ready(mpu)) | ||
438 | break; /* Tx FIFO full - try again later */ | 439 | break; /* Tx FIFO full - try again later */ |
439 | mpu->write(mpu, byte, MPU401D(mpu)); | 440 | mpu->write(mpu, byte, MPU401D(mpu)); |
440 | snd_rawmidi_transmit_ack(mpu->substream_output, 1); | 441 | snd_rawmidi_transmit_ack(mpu->substream_output, 1); |