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:
@@ -1175,8 +1175,7 @@ static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream,
|
||||
if (port->ep->umidi->disconnected) {
|
||||
/* gobble up remaining bytes to prevent wait in
|
||||
* snd_rawmidi_drain_output */
|
||||
while (!snd_rawmidi_transmit_empty(substream))
|
||||
snd_rawmidi_transmit_ack(substream, 1);
|
||||
snd_rawmidi_proceed(substream);
|
||||
return;
|
||||
}
|
||||
tasklet_schedule(&port->ep->tasklet);
|
||||
|
Reference in New Issue
Block a user