[I810_AUDIO] 10/x: Fix reads/writes % 4 != 0
diff mbox series

Message ID 20031123110401.GA15665@gondor.apana.org.au
State New, archived
Headers show
Series
  • [I810_AUDIO] 10/x: Fix reads/writes % 4 != 0
Related show

Commit Message

Herbert Xu Nov. 23, 2003, 11:04 a.m. UTC
This patch removes another bogus chunk of code that breaks when
the application does a partial write.

In particular, a read/write of x bytes where x % 4 != 0 will loop forever.

Patch
diff mbox series

Index: kernel-source-2.4/drivers/sound/i810_audio.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.4/drivers/sound/i810_audio.c,v
retrieving revision 1.17
diff -u -r1.17 i810_audio.c
--- kernel-source-2.4/drivers/sound/i810_audio.c	23 Nov 2003 00:34:22 -0000	1.17
+++ kernel-source-2.4/drivers/sound/i810_audio.c	23 Nov 2003 10:59:46 -0000
@@ -1487,15 +1487,6 @@ 
 
 		if (cnt > count)
 			cnt = count;
-		/* Lop off the last two bits to force the code to always
-		 * write in full samples.  This keeps software that sets
-		 * O_NONBLOCK but doesn't check the return value of the
-		 * write call from getting things out of state where they
-		 * think a full 4 byte sample was written when really only
-		 * a portion was, resulting in odd sound and stereo
-		 * hysteresis.
-		 */
-		cnt &= ~0x3;
 		if (cnt <= 0) {
 			unsigned long tmo;
 			/*
@@ -1643,15 +1634,6 @@ 
 #endif
 		if (cnt > count)
 			cnt = count;
-		/* Lop off the last two bits to force the code to always
-		 * write in full samples.  This keeps software that sets
-		 * O_NONBLOCK but doesn't check the return value of the
-		 * write call from getting things out of state where they
-		 * think a full 4 byte sample was written when really only
-		 * a portion was, resulting in odd sound and stereo
-		 * hysteresis.
-		 */
-		cnt &= ~0x3;
 		if (cnt <= 0) {
 			unsigned long tmo;
 			// There is data waiting to be played