es1371 midi_read patch

Andy Sloane (andy@guildsoftware.com)
Thu, 2 Sep 1999 12:40:53 -0500


--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii

When doing a read() call on /dev/midi using the es1371 driver, the driver
waits for the entire buffer you specify to be filled. Well, this basically
defeats the purpose of realtime midi input unless you poll it with a
one-byte buffer.

Attached is a quick fix. I haven't even looked at the 1370 driver, but a
similar patch might apply there.

-Andy

--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="es1371.patch"

--- /usr/src/linux/drivers/sound/es1371.c Mon Apr 12 18:18:27 1999
+++ es1371.c Thu Sep 2 12:35:09 1999
@@ -2468,7 +2468,7 @@
if (!access_ok(VERIFY_WRITE, buffer, count))
return -EFAULT;
ret = 0;
- while (count > 0) {
+read_more:
spin_lock_irqsave(&s->lock, flags);
ptr = s->midi.ird;
cnt = MIDIINBUF - ptr;
@@ -2483,7 +2483,7 @@
interruptible_sleep_on(&s->midi.iwait);
if (signal_pending(current))
return ret ? ret : -ERESTARTSYS;
- continue;
+ goto read_more;
}
if (copy_to_user(buffer, s->midi.ibuf + ptr, cnt))
return ret ? ret : -EFAULT;
@@ -2495,7 +2495,6 @@
count -= cnt;
buffer += cnt;
ret += cnt;
- }
return ret;
}

--PEIAKu/WMn1b1Hv9--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/