Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Call frontend enable/disable functions in the ioc...



details:   https://anonhg.NetBSD.org/src/rev/11c96083b0ce
branches:  trunk
changeset: 487849:11c96083b0ce
user:      soren <soren%NetBSD.org@localhost>
date:      Tue Jun 13 20:00:02 2000 +0000

description:
Call frontend enable/disable functions in the ioctl path.
Use _sc prefixes for some softc members.
A few minor cleanups.

diffstat:

 sys/dev/ic/tropic.c    |  29 +++++++++++++++++------------
 sys/dev/ic/tropicvar.h |  10 +++++-----
 2 files changed, 22 insertions(+), 17 deletions(-)

diffs (133 lines):

diff -r 3adb260097ea -r 11c96083b0ce sys/dev/ic/tropic.c
--- a/sys/dev/ic/tropic.c       Tue Jun 13 18:17:13 2000 +0000
+++ b/sys/dev/ic/tropic.c       Tue Jun 13 20:00:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tropic.c,v 1.10 2000/06/06 16:41:33 soren Exp $        */
+/*     $NetBSD: tropic.c,v 1.11 2000/06/13 20:00:02 soren Exp $        */
 
 /* 
  * Ported to NetBSD by Onno van der Linden
@@ -445,7 +445,7 @@
        callout_init(&sc->sc_init_callout);
        callout_init(&sc->sc_reinit_callout);
 
-       sc->sd_hook = shutdownhook_establish(tr_shutdown, sc);
+       sc->sc_sdhook = shutdownhook_establish(tr_shutdown, sc);
        return 0;
 }
 
@@ -889,7 +889,7 @@
                                                sc->sc_nbuf =
                                                    sc->sc_xmit_buffers;
 #ifdef TROPICDEBUG
-                                               printf("%s: buffers = %d\n",
+                                               printf("%s: %d buffers\n",
                                                    sc->sc_dev.dv_xname,
                                                    sc->sc_xmit_buffers);
 #endif
@@ -1137,7 +1137,7 @@
        }
        /* Is this interrupt caused by an adapter error or access violation? */
        if (ACA_RDB(sc, ACA_ISRP_e) & (TCR_INT | ERR_INT | ACCESS_INT)) {
-               printf("%s: adapter error, ISRP_e = %x\n",
+               printf("%s: adapter error, ISRP_e = 0x%x\n",
                    sc->sc_dev.dv_xname, ACA_RDB(sc, ACA_ISRP_e));
 
                /* Clear these interrupt bits */
@@ -1414,7 +1414,7 @@
                txbuf = TXB_INW(sc, txbuf, XMIT_NEXTBUF) - XMIT_NEXTBUF;
                if (TXB_INB(sc, txbuf, XMIT_RETCODE) != 0) {
                        ifp->if_oerrors++;
-                       printf("%s: xmit error = %x\n", sc->sc_dev.dv_xname,
+                       printf("%s: xmit error = 0x%x\n", sc->sc_dev.dv_xname,
                            TXB_INB(sc, txbuf, XMIT_RETCODE));
                }
                sc->sc_xmit_buffers +=
@@ -1546,6 +1546,8 @@
 
        switch (cmd) {
        case SIOCSIFADDR:
+               if ((error = tr_enable(sc)) != 0)
+                       break;
 
                switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
@@ -1577,8 +1579,11 @@
                if ((ifp->if_flags & (IFF_RUNNING | IFF_UP)) == IFF_RUNNING) {
                        tr_stop(sc);
                        ifp->if_flags &= ~IFF_RUNNING;
+                       tr_disable(sc);
                }
                else if ((ifp->if_flags & (IFF_RUNNING | IFF_UP)) == IFF_UP) {
+                       if ((error = tr_enable(sc)) != 0)
+                               break;
                        tr_init(sc);
                        tr_sleep(sc);
                }
@@ -1738,15 +1743,15 @@
 tr_enable(sc)
        struct tr_softc *sc;
 {       
-       if (sc->enabled == 0 && sc->enable != NULL) {
-               if ((*sc->enable)(sc) != 0) {
+       if (sc->sc_enabled == 0 && sc->sc_enable != NULL) {
+               if ((*sc->sc_enable)(sc) != 0) {
                        printf("%s: device enable failed\n",
                                sc->sc_dev.dv_xname);
                        return (EIO);
                } 
        }
         
-       sc->enabled = 1;
+       sc->sc_enabled = 1;
        return (0);
 }               
         
@@ -1754,9 +1759,9 @@
 tr_disable(sc)
        struct tr_softc *sc;
 {
-       if (sc->enabled != 0 && sc->disable != NULL) {
-               (*sc->disable)(sc);
-               sc->enabled = 0;
+       if (sc->sc_enabled != 0 && sc->sc_disable != NULL) {
+               (*sc->sc_disable)(sc);
+               sc->sc_enabled = 0;
        } 
 }       
 
@@ -1806,7 +1811,7 @@
        token_ifdetach(ifp);
        if_detach(ifp);
 
-       shutdownhook_disestablish(sc->sd_hook);
+       shutdownhook_disestablish(sc->sc_sdhook);
 
        return (0);
 }
diff -r 3adb260097ea -r 11c96083b0ce sys/dev/ic/tropicvar.h
--- a/sys/dev/ic/tropicvar.h    Tue Jun 13 18:17:13 2000 +0000
+++ b/sys/dev/ic/tropicvar.h    Tue Jun 13 20:00:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tropicvar.h,v 1.7 2000/06/06 16:26:58 soren Exp $      */
+/*     $NetBSD: tropicvar.h,v 1.8 2000/06/13 20:00:03 soren Exp $      */
 
 /* 
  * Mach Operating System
@@ -94,12 +94,12 @@
                                        /* open of adapter  */
        unsigned short exsap_station;   /* station assigned by open sap cmd */
 
-       void *sd_hook;
+       void *sc_sdhook;
 
        /* Power management hooks */    
-       int (*enable) __P((struct tr_softc *));
-       void (*disable) __P((struct tr_softc *));
-       int enabled;
+       int (*sc_enable) __P((struct tr_softc *));
+       void (*sc_disable) __P((struct tr_softc *));
+       int sc_enabled;
 };
 
 int tr_config __P((struct tr_softc *));



Home | Main Index | Thread Index | Old Index