[alsa-devel] [PATCH] echoaudio, about changeset 5389

Giuliano Pochini pochini at shiny.it
Sun Sep 16 23:04:06 CEST 2007


About changeset 5389: Remove superfluous volatile prefix. It's fine, except
for the struct comm_page.handshake which is polled by
echoaudio_dsp.c::wait_handshake(). Without volatile we need another way to
prevent the compiler from moving the read outside of the loop. If I
overlooked something, please let me know.


Short descr.: This patch adds a barrier() to prevent the compiler from
moving the read outside of the loop. It also fixes a comment.

Signed-off-by: Giuliano Pochini <pochini at shiny.it>

--- alsa-kernel/pci/echoaudio/echoaudio_dsp.c__orig	2007-09-16 22:33:37.000000000 +0200
+++ alsa-kernel/pci/echoaudio/echoaudio_dsp.c	2007-09-16 22:39:58.000000000 +0200
@@ -43,11 +43,11 @@ static int wait_handshake(struct echoaud
 {
 	int i;
 
-	/* Wait up to 10ms for the handshake from the DSP */
+	/* Wait up to 20ms for the handshake from the DSP */
 	for (i = 0; i < HANDSHAKE_TIMEOUT; i++) {
 		/* Look for the handshake value */
+		barrier();
 		if (chip->comm_page->handshake) {
-			/*if (i)  DE_ACT(("Handshake time: %d\n", i));*/
 			return 0;
 		}
 		udelay(1);


--
Giuliano.


More information about the Alsa-devel mailing list