Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: linux-sound@vger.kernel.org
Subject: [PATCH][2.2.x,2.4.x] OSS MIDI output loses data
Date: Thu, 28 Nov 2002 12:10:34 +0000	[thread overview]
Message-ID: <marc-linux-sound-103848544518164@msgid-missing> (raw)


In the 2.1.6 kernel, the output loop in midi_poll() was changed to enable
interrupts during the outputc() call. Unfortunately, the check whether the
device has accepted the current byte ("ok") was moved behind the code
which removes the byte from the output queue, so one byte would be lost
every time the hardware FIFO is full.

-- 
Clemens


--- linux-2.4.19/drivers/sound/midibuf.c	Wed Nov 27 12:34:56 2002
+++ linux/drivers/sound/midibuf.c	Wed Nov 27 16:32:31 2002
@@ -129,15 +129,16 @@
 		for (dev = 0; dev < num_midis; dev++)
 			if (midi_devs[dev] != NULL && midi_out_buf[dev] != NULL)
 			{
-				int ok = 1;
-
-				while (DATA_AVAIL(midi_out_buf[dev]) && ok)
+				while (DATA_AVAIL(midi_out_buf[dev]))
 				{
+					int ok;
 					int c = midi_out_buf[dev]->queue[midi_out_buf[dev]->head];

 					restore_flags(flags);	/* Give some time to others */
 					ok = midi_devs[dev]->outputc(dev, c);
 					cli();
+					if (!ok)
+						break;
 					midi_out_buf[dev]->head = (midi_out_buf[dev]->head + 1) % MAX_QUEUE_SIZE;
 					midi_out_buf[dev]->len--;
 				}


                 reply	other threads:[~2002-11-28 12:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-sound-103848544518164@msgid-missing \
    --to=clemens@ladisch.de \
    --cc=linux-sound@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox