ALSA: rawmidi: A lightweight function to discard pending bytes

For discarding the pending bytes on rawmidi, we process with a loop of
snd_rawmidi_transmit() which is just a waste of CPU power.
Implement a lightweight API function to discard the pending bytes and
the proceed the ring buffer instantly, and use it instead of open
codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai
2018-09-13 08:20:43 +02:00
förälder cd3b7116b5
incheckning 6aea5702e2
4 ändrade filer med 25 tillägg och 5 borttagningar

Visa fil

@@ -149,9 +149,7 @@ static void snd_vmidi_output_work(struct work_struct *work)
/* discard the outputs in dispatch mode unless subscribed */
if (vmidi->seq_mode == SNDRV_VIRMIDI_SEQ_DISPATCH &&
!(vmidi->rdev->flags & SNDRV_VIRMIDI_SUBSCRIBE)) {
char buf[32];
while (snd_rawmidi_transmit(substream, buf, sizeof(buf)) > 0)
; /* ignored */
snd_rawmidi_proceed(substream);
return;
}