diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-08-10 04:05:23 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-08-10 07:15:43 -0400 |
commit | 5e8e7c38533a8f86626e9410fa38f5854a6959df (patch) | |
tree | d5d3b55d750a3225720f56eb71b2d0dba16fc8fd | |
parent | ed680c4ad478d0fee9740f7d029087f181346564 (diff) |
sound: fix OSS MIDI output data loss
In the 2.1.6 kernel, the output loop in midi_poll() was changed to
enable interrupts during the outputc() call. Unfortunately, the check
whether the device has accepted the current byte ("ok") was moved behind
the code that removes the byte from the output queue, so one byte would
be lost every time the hardware FIFO is full.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/oss/midibuf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c index a40be0cf1d97..782b3b84dac6 100644 --- a/sound/oss/midibuf.c +++ b/sound/oss/midibuf.c | |||
@@ -127,15 +127,16 @@ static void midi_poll(unsigned long dummy) | |||
127 | for (dev = 0; dev < num_midis; dev++) | 127 | for (dev = 0; dev < num_midis; dev++) |
128 | if (midi_devs[dev] != NULL && midi_out_buf[dev] != NULL) | 128 | if (midi_devs[dev] != NULL && midi_out_buf[dev] != NULL) |
129 | { | 129 | { |
130 | int ok = 1; | 130 | while (DATA_AVAIL(midi_out_buf[dev])) |
131 | |||
132 | while (DATA_AVAIL(midi_out_buf[dev]) && ok) | ||
133 | { | 131 | { |
132 | int ok; | ||
134 | int c = midi_out_buf[dev]->queue[midi_out_buf[dev]->head]; | 133 | int c = midi_out_buf[dev]->queue[midi_out_buf[dev]->head]; |
135 | 134 | ||
136 | spin_unlock_irqrestore(&lock,flags);/* Give some time to others */ | 135 | spin_unlock_irqrestore(&lock,flags);/* Give some time to others */ |
137 | ok = midi_devs[dev]->outputc(dev, c); | 136 | ok = midi_devs[dev]->outputc(dev, c); |
138 | spin_lock_irqsave(&lock, flags); | 137 | spin_lock_irqsave(&lock, flags); |
138 | if (!ok) | ||
139 | break; | ||
139 | midi_out_buf[dev]->head = (midi_out_buf[dev]->head + 1) % MAX_QUEUE_SIZE; | 140 | midi_out_buf[dev]->head = (midi_out_buf[dev]->head + 1) % MAX_QUEUE_SIZE; |
140 | midi_out_buf[dev]->len--; | 141 | midi_out_buf[dev]->len--; |
141 | } | 142 | } |