Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Oct 1997 09:32:50 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        msmith@FreeBSD.ORG, jkh@time.cdrom.com, stable@FreeBSD.ORG
Subject:   missing parentheses in isa.c
Message-ID:  <199710180832.JAA15606@labinfo.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
for a long time, checks in isa.c to determine if a DMA channel is in
use have been broken:

The typical error pattern and fix is as follows:

	-       if (dma_inuse & (1 << chan) == 0)
	+       if ((dma_inuse & (1 << chan)) == 0)

and occurs 4 times in isa.c. The code has been fixed in -current,
I suggest that the fix is brought over to -RELEASE. As it is now, these
tests always fail.

Relevant diffs against 2.2.5-971015-BETA /sys/i386/isa/isa.c are
as follows (you have to apply them by hand since i have other local
modifications and line numbers might not match):

@@ -590,7 +592,7 @@
        if (chan & ~VALID_DMA_MASK)
                panic("isa_dma_release: channel out of range");
 
-       if (dma_inuse & (1 << chan) == 0)
+       if ((dma_inuse & (1 << chan)) == 0)
                printf("isa_dma_release: channel %d not in use\n", chan);
 #endif
 
@@ -646,11 +732,11 @@
        if ((chan < 4 && nbytes > (1<<16))
            || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
                panic("isa_dmastart: impossible request");
-
-       if (dma_inuse & (1 << chan) == 0)
-               printf("isa_dmastart: channel %d not acquired\n", chan);
 #endif
+       if ((dma_inuse & (1 << chan)) == 0)
+               printf("isa_dmastart: channel %d not acquired\n", chan);
 
@@ -742,25 +834,37 @@
        }
 }
 
 {  
 #ifdef DIAGNOSTIC
        if (chan & ~VALID_DMA_MASK)
                panic("isa_dmadone: channel out of range");
 
-       if (dma_inuse & (1 << chan) == 0)
+       if ((dma_inuse & (1 << chan)) == 0)
                printf("isa_dmadone: channel %d not acquired\n", chan);
 #endif
 
#if 0
        /*
         * XXX This should be checked, but drivers like ad1848 only call
         * isa_dmastart() once because they use Auto DMA mode.  If we
         * leave this in, drivers that do this will print this continuously.
         */
-       if (dma_busy & (1 << chan) == 0)
+       if ((dma_busy & (1 << chan)) == 0)


	Cheers
	Luigi
-----------------------------+--------------------------------------
Luigi Rizzo                  |  Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it    |  Universita' di Pisa
tel: +39-50-568533           |  via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522           |  http://www.iet.unipi.it/~luigi/
_____________________________|______________________________________



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710180832.JAA15606>