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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Referens i nytt ärende
Block a user