NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-acorn32/46576: Shutdown doesn't disable TX/RX interrupts in SEEQ8005 driver



>Number:         46576
>Category:       port-acorn32
>Synopsis:       Shutdown doesn't disable TX/RX interrupts in SEEQ8005 driver
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-acorn32-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 10 14:55:00 +0000 2012
>Originator:     Robert Sprowson
>Release:        
>Organization:
>Environment:
>Description:
In porting the SEEQ8005 I've spotted a few problems and a few bits of code 
cleanup. The "fix" text is supplied in the form of a unified diff against 
"seeq8005.c,v 1.47" in src/sys/dev/ic, if the web form messes it up it can be 
mailed.

Line 477:
A missing '~' means that the RX and TX interrupts aren't actually disabled on 
shutdown. This is problematic in my port where the driver can be restarted at 
runtime rather than just once on boot.

Line 493; 1160; 
Odd tab/space made consistent with rest of the source file.

Line 833; 981; 1485;
Typo/spelling mistake correction.

Line 888; 1111: 
Function declared as static at the top of the file, but has external linkage 
further down.

Line 1238; 1267; 1296:
Assignment of integer to pointer type. Changed from '0' to 'NULL'.
>How-To-Repeat:

>Fix:
--- orgseeq8005.c       Sun Jun 10 15:36:08 2012
+++ updseeq8005.c       Sun Jun 10 15:33:54 2012
@@ -477,7 +479,7 @@
        ea_stoprx(sc);
 
        /* Disable rx and tx interrupts */
-       sc->sc_command &= (SEEQ_CMD_RX_INTEN | SEEQ_CMD_TX_INTEN);
+       sc->sc_command &= ~(SEEQ_CMD_RX_INTEN | SEEQ_CMD_TX_INTEN);
 
        /* Clear any pending interrupts */
        SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
@@ -493,7 +495,7 @@
        }
 
        /* Cancel any watchdog timer */
-               sc->sc_ethercom.ec_if.if_timer = 0;
+       sc->sc_ethercom.ec_if.if_timer = 0;
 }
 
 
@@ -833,7 +835,7 @@
        SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
                          sc->sc_command | SEEQ_CMD_RX_ON);
 
-       /* TX_ON gets set by ea_txpacket when there's something to transmit. */
+       /* TX_ON gets set by eatxpacket when there's something to transmit. */
 
 
        /* Set flags appropriately. */
@@ -888,7 +890,7 @@
  * Called at splnet()
  */
 
-void
+static void
 eatxpacket(struct seeq8005_softc *sc)
 {
        bus_space_tag_t iot = sc->sc_iot;
@@ -981,7 +983,7 @@
        hdr[1] = nextpacket & 0xff;
        hdr[2] = SEEQ_PKTCMD_TX | SEEQ_PKTCMD_DATA_FOLLOWS |
                SEEQ_TXCMD_XMIT_SUCCESS_INT | SEEQ_TXCMD_COLLISION_INT;
-       hdr[3] = 0; /* Status byte -- will be update by hardware. */
+       hdr[3] = 0; /* Status byte -- will be updated by hardware. */
        ea_writebuf(sc, hdr, 0x0000, 4);
 
        return len;
@@ -1111,7 +1113,7 @@
        }
 }
 
-void
+static void
 ea_rxint(struct seeq8005_softc *sc)
 {
        bus_space_tag_t iot = sc->sc_iot;
@@ -1160,7 +1162,7 @@
                }
 
                /* Get packet length */
-                       len = (ptr - addr) - 4;
+               len = (ptr - addr) - 4;
 
                if (len < 0)
                        len += sc->sc_rx_bufsize;
@@ -1238,7 +1240,7 @@
 
        /* Pull packet off interface. */
        m = ea_get(sc, addr, len, ifp);
-       if (m == 0)
+       if (m == NULL)
                return;
 
        /*
@@ -1267,20 +1269,20 @@
         epkt = cp + totlen;
 
         MGETHDR(m, M_DONTWAIT, MT_DATA);
-        if (m == 0)
-                return 0;
+        if (m == NULL)
+                return NULL;
         m->m_pkthdr.rcvif = ifp;
         m->m_pkthdr.len = totlen;
         m->m_len = MHLEN;
-        top = 0;
+        top = NULL;
         mp = &top;
 
         while (totlen > 0) {
                 if (top) {
                         MGET(m, M_DONTWAIT, MT_DATA);
-                        if (m == 0) {
+                        if (m == NULL) {
                                 m_freem(top);
-                                return 0;
+                                return NULL;
                         }
                         m->m_len = MLEN;
                 }
@@ -1296,13 +1298,13 @@
                          * Place initial small packet/header at end of mbuf.
                          */
                         if (len < m->m_len) {
-                                if (top == 0 && len + max_linkhdr <= m->m_len)
+                                if (top == NULL && len + max_linkhdr <= 
m->m_len)
                                         m->m_data += max_linkhdr;
                                 m->m_len = len;
                         } else
                                 len = m->m_len;
                 }
-               if (top == 0) {
+               if (top == NULL) {
                        /* Make sure the payload is aligned */
                        char *newdata = (char *)
                            ALIGN((char*)m->m_data + 
@@ -1485,4 +1487,4 @@
        ifp->if_timer = 0;
 }
 
-/* End of if_ea.c */
+/* End of seeq8005.c */



Home | Main Index | Thread Index | Old Index