From patchwork Thu Oct 8 23:10:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 7356951 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 282C1BEEA4 for ; Thu, 8 Oct 2015 23:11:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5ECE1207B2 for ; Thu, 8 Oct 2015 23:11:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 30EEB2078D for ; Thu, 8 Oct 2015 23:11:19 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EC0B426686C; Fri, 9 Oct 2015 01:11:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 670F5266801; Fri, 9 Oct 2015 01:10:44 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A55072667C3; Fri, 9 Oct 2015 01:10:41 +0200 (CEST) Received: from smtp302.phy.lolipop.jp (smtp302.phy.lolipop.jp [210.157.22.85]) by alsa0.perex.cz (Postfix) with ESMTP id 64396265062 for ; Fri, 9 Oct 2015 01:10:34 +0200 (CEST) Received: from smtp302.phy.lolipop.lan (HELO smtp302.phy.lolipop.jp) (172.17.1.85) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp302.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Fri, 09 Oct 2015 08:10:32 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp302.phy.lolipop.jp (LOLIPOP-Fsecure); Fri, 09 Oct 2015 08:10:29 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Fri, 9 Oct 2015 08:10:27 +0900 Message-Id: <1444345829-17408-4-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444345829-17408-1-git-send-email-o-takashi@sakamocchi.jp> References: <1444345829-17408-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 3/5] ALSA: firewire-lib: schedule work again when MIDI substream has rest of MIDI messages X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, when two MIDI trigger callbacks can be called immediately, transactions for the second MIDI messages can be postpone till next trigger callback. This is not good for real-time message transmission. This commit schedules work again at response handling callback if the MIDI substream still includes untransferred MIDI messages. Signed-off-by: Takashi Sakamoto --- sound/firewire/lib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/firewire/lib.c b/sound/firewire/lib.c index ddc3e88..3e9afd7 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)) + schedule_work(&port->work); } static void midi_port_work(struct work_struct *work)