diff mbox

[RFC,05/37] ALSA: firewire-lib: schedule tasklet again when MIDI substream has rest of MIDI messages

Message ID 1436623968-10780-6-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Sakamoto July 11, 2015, 2:12 p.m. UTC
Two MIDI trigger callbacks can be called immediately. This can postpone
second MIDI transaction till next trigger callback.

To avoid this delay, this commit schedules tasklet again at response
handling callback if the MIDI substream still includes untransferred
MIDI messages.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/lib.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/sound/firewire/lib.c b/sound/firewire/lib.c
index a66e011..e309b9b 100644
--- a/sound/firewire/lib.c
+++ b/sound/firewire/lib.c
@@ -78,6 +78,9 @@  static void async_midi_port_callback(struct fw_card *card, int rcode,
 		snd_rawmidi_transmit_ack(substream, port->consume_bytes);
 
 	port->idling = true;
+
+	if (!snd_rawmidi_transmit_empty(substream))
+		tasklet_schedule(&port->tasklet);
 }
 
 static void midi_port_tasklet(unsigned long data)