Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Simplify device-activation hooks.



details:   https://anonhg.NetBSD.org/src/rev/6cf1ba12e05b
branches:  trunk
changeset: 749746:6cf1ba12e05b
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Sun Dec 06 23:17:09 2009 +0000

description:
Simplify device-activation hooks.

diffstat:

 sys/dev/ic/dp8390.c   |  18 ++++++------------
 sys/dev/ic/mb86950.c  |  19 ++++++-------------
 sys/dev/ic/mb86960.c  |  19 ++++++-------------
 sys/dev/ic/smc91cxx.c |  18 ++++++------------
 4 files changed, 24 insertions(+), 50 deletions(-)

diffs (178 lines):

diff -r b042c2148158 -r 6cf1ba12e05b sys/dev/ic/dp8390.c
--- a/sys/dev/ic/dp8390.c       Sun Dec 06 23:15:59 2009 +0000
+++ b/sys/dev/ic/dp8390.c       Sun Dec 06 23:17:09 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dp8390.c,v 1.71 2009/05/12 14:25:17 cegger Exp $       */
+/*     $NetBSD: dp8390.c,v 1.72 2009/12/06 23:17:09 dyoung Exp $       */
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.71 2009/05/12 14:25:17 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.72 2009/12/06 23:17:09 dyoung Exp $");
 
 #include "opt_ipkdb.h"
 #include "opt_inet.h"
@@ -1247,21 +1247,15 @@
 int
 dp8390_activate(device_t self, enum devact act)
 {
-       struct dp8390_softc *sc = (struct dp8390_softc *)self;
-       int rv = 0, s;
+       struct dp8390_softc *sc = device_private(self);
 
-       s = splnet();
        switch (act) {
-       case DVACT_ACTIVATE:
-               rv = EOPNOTSUPP;
-               break;
-
        case DVACT_DEACTIVATE:
                if_deactivate(&sc->sc_ec.ec_if);
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       splx(s);
-       return (rv);
 }
 
 int
diff -r b042c2148158 -r 6cf1ba12e05b sys/dev/ic/mb86950.c
--- a/sys/dev/ic/mb86950.c      Sun Dec 06 23:15:59 2009 +0000
+++ b/sys/dev/ic/mb86950.c      Sun Dec 06 23:17:09 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mb86950.c,v 1.15 2009/05/12 14:25:17 cegger Exp $      */
+/*     $NetBSD: mb86950.c,v 1.16 2009/12/06 23:18:37 dyoung Exp $      */
 
 /*
  * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -67,7 +67,7 @@
   */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.15 2009/05/12 14:25:17 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.16 2009/12/06 23:18:37 dyoung Exp $");
 
 /*
  * Device driver for Fujitsu mb86950 based Ethernet cards.
@@ -965,22 +965,15 @@
 int
 mb86950_activate(device_t self, enum devact act)
 {
-       struct mb86950_softc *sc = (struct mb86950_softc *)self;
-       int rv, s;
+       struct mb86950_softc *sc = device_private(self);
 
-       rv = 0;
-       s = splnet();
        switch (act) {
-       case DVACT_ACTIVATE:
-               rv = EOPNOTSUPP;
-               break;
-
        case DVACT_DEACTIVATE:
                if_deactivate(&sc->sc_ec.ec_if);
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       splx(s);
-       return (rv);
 }
 
 /*
diff -r b042c2148158 -r 6cf1ba12e05b sys/dev/ic/mb86960.c
--- a/sys/dev/ic/mb86960.c      Sun Dec 06 23:15:59 2009 +0000
+++ b/sys/dev/ic/mb86960.c      Sun Dec 06 23:17:09 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mb86960.c,v 1.74 2009/09/12 19:55:29 tsutsui Exp $     */
+/*     $NetBSD: mb86960.c,v 1.75 2009/12/06 23:18:37 dyoung Exp $      */
 
 /*
  * All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.74 2009/09/12 19:55:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.75 2009/12/06 23:18:37 dyoung Exp $");
 
 /*
  * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
@@ -1802,22 +1802,15 @@
 int
 mb86960_activate(device_t self, enum devact act)
 {
-       struct mb86960_softc *sc = (struct mb86960_softc *)self;
-       int rv, s;
+       struct mb86960_softc *sc = device_private(self);
 
-       rv = 0;
-       s = splnet();
        switch (act) {
-       case DVACT_ACTIVATE:
-               rv = EOPNOTSUPP;
-               break;
-
        case DVACT_DEACTIVATE:
                if_deactivate(&sc->sc_ec.ec_if);
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       splx(s);
-       return rv;
 }
 
 /*
diff -r b042c2148158 -r 6cf1ba12e05b sys/dev/ic/smc91cxx.c
--- a/sys/dev/ic/smc91cxx.c     Sun Dec 06 23:15:59 2009 +0000
+++ b/sys/dev/ic/smc91cxx.c     Sun Dec 06 23:17:09 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc91cxx.c,v 1.75 2009/05/12 14:25:18 cegger Exp $     */
+/*     $NetBSD: smc91cxx.c,v 1.76 2009/12/06 23:18:37 dyoung Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.75 2009/05/12 14:25:18 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.76 2009/12/06 23:18:37 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "bpfilter.h"
@@ -1509,21 +1509,15 @@
 int
 smc91cxx_activate(device_t self, enum devact act)
 {
-       struct smc91cxx_softc *sc = (struct smc91cxx_softc *)self;
-       int rv = 0, s;
+       struct smc91cxx_softc *sc = device_private(self);
 
-       s = splnet();
        switch (act) {
-       case DVACT_ACTIVATE:
-               rv = EOPNOTSUPP;
-               break;
-
        case DVACT_DEACTIVATE:
                if_deactivate(&sc->sc_ec.ec_if);
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       splx(s);
-       return (rv);
 }
 
 int



Home | Main Index | Thread Index | Old Index