summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorStefan Sauer <st_kost@gmx.de>2022-01-06 15:41:45 +0300
committerTakashi Iwai <tiwai@suse.de>2022-01-06 18:08:07 +0300
commit7560ee032b3f87fa5c4f03e99a064c6cd326951e (patch)
tree17bdba5018a5731faecc565b2bebc39cbf312273 /sound
parentb81e9e5c723de936652653241d3dc4f33ae05e8c (diff)
downloadlinux-7560ee032b3f87fa5c4f03e99a064c6cd326951e.tar.xz
ALSA: seq: virmidi: Add a drain operation
If a driver does not supply a drain operation for outputs, a default code path will execute msleep(50). Especially for a virtual midi device this severely limmits the throughput. This implementation for the virtual midi driver simply flushes the output workqueue. Signed-off-by: Stefan Sauer <st_kost@gmx.de> Link: https://lore.kernel.org/r/20220106124145.17254-1-st_kost@gmx.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/seq/seq_virmidi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 4abc38c70cae..f5cae49500c8 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -263,6 +263,16 @@ static int snd_virmidi_output_close(struct snd_rawmidi_substream *substream)
}
/*
+ * drain output work queue
+ */
+static void snd_virmidi_output_drain(struct snd_rawmidi_substream *substream)
+{
+ struct snd_virmidi *vmidi = substream->runtime->private_data;
+
+ flush_work(&vmidi->output_work);
+}
+
+/*
* subscribe callback - allow output to rawmidi device
*/
static int snd_virmidi_subscribe(void *private_data,
@@ -336,6 +346,7 @@ static const struct snd_rawmidi_ops snd_virmidi_output_ops = {
.open = snd_virmidi_output_open,
.close = snd_virmidi_output_close,
.trigger = snd_virmidi_output_trigger,
+ .drain = snd_virmidi_output_drain,
};
/*