Module Name:    src
Committed By:   dyoung
Date:           Sun Dec  6 23:05:06 UTC 2009

Modified Files:
        src/sys/dev/pcmcia: if_cnw.c if_ray.c isic_pcmcia.c

Log Message:
Simplify device-activation hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pcmcia/if_cnw.c
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/pcmcia/if_ray.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pcmcia/isic_pcmcia.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pcmcia/if_cnw.c
diff -u src/sys/dev/pcmcia/if_cnw.c:1.52 src/sys/dev/pcmcia/if_cnw.c:1.53
--- src/sys/dev/pcmcia/if_cnw.c:1.52	Sun Nov 22 21:18:42 2009
+++ src/sys/dev/pcmcia/if_cnw.c	Sun Dec  6 23:05:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnw.c,v 1.52 2009/11/22 21:18:42 dsl Exp $	*/
+/*	$NetBSD: if_cnw.c,v 1.53 2009/12/06 23:05:06 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.52 2009/11/22 21:18:42 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.53 2009/12/06 23:05:06 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "bpfilter.h"
@@ -1176,20 +1176,14 @@
 cnw_activate(device_t self, enum devact act)
 {
 	struct cnw_softc *sc = (struct cnw_softc *)self;
-	int rv = 0, s;
 
-	s = splnet();
 	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
 	case DVACT_DEACTIVATE:
 		if_deactivate(&sc->sc_ethercom.ec_if);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	splx(s);
-	return (rv);
 }
 
 int

Index: src/sys/dev/pcmcia/if_ray.c
diff -u src/sys/dev/pcmcia/if_ray.c:1.76 src/sys/dev/pcmcia/if_ray.c:1.77
--- src/sys/dev/pcmcia/if_ray.c:1.76	Sat Sep  5 14:44:59 2009
+++ src/sys/dev/pcmcia/if_ray.c	Sun Dec  6 23:05:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ray.c,v 1.76 2009/09/05 14:44:59 tsutsui Exp $	*/
+/*	$NetBSD: if_ray.c,v 1.77 2009/12/06 23:05:06 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2000 Christian E. Hopps
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.76 2009/09/05 14:44:59 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.77 2009/12/06 23:05:06 dyoung Exp $");
 
 #include "opt_inet.h"
 #include "bpfilter.h"
@@ -619,27 +619,20 @@
 }
 
 static int
-ray_activate(device_t dev, enum devact act)
+ray_activate(device_t self, enum devact act)
 {
-	struct ray_softc *sc = (struct ray_softc *)dev;
+	struct ray_softc *sc = device_private(self);
 	struct ifnet *ifp = &sc->sc_if;
-	int s;
-	int rv = 0;
 
-	RAY_DPRINTF(("%s: activate\n", device_xname(&sc->sc_dev)));
+	RAY_DPRINTF(("%s: activate\n", device_xname(self)));
 
-	s = splnet();
 	switch (act) {
-	case DVACT_ACTIVATE:
-		rv = EOPNOTSUPP;
-		break;
-
 	case DVACT_DEACTIVATE:
 		if_deactivate(ifp);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	splx(s);
-	return (rv);
 }
 
 static int

Index: src/sys/dev/pcmcia/isic_pcmcia.c
diff -u src/sys/dev/pcmcia/isic_pcmcia.c:1.39 src/sys/dev/pcmcia/isic_pcmcia.c:1.40
--- src/sys/dev/pcmcia/isic_pcmcia.c:1.39	Tue May 12 14:42:18 2009
+++ src/sys/dev/pcmcia/isic_pcmcia.c	Sun Dec  6 23:05:06 2009
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.39 2009/05/12 14:42:18 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_pcmcia.c,v 1.40 2009/12/06 23:05:06 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -248,23 +248,17 @@
 int
 isic_pcmcia_activate(device_t self, enum devact act)
 {
-	struct pcmcia_isic_softc *psc = (struct pcmcia_isic_softc *)self;
-	int error = 0, s;
+	struct pcmcia_isic_softc *psc = device_private(self);
 
-	s = splnet();
 	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-
 	case DVACT_DEACTIVATE:
 		psc->sc_isic.sc_intr_valid = ISIC_INTR_DYING;
 		if (psc->sc_isic.sc_l3token != NULL)
 			isic_detach_bri(&psc->sc_isic);
-		break;
+		return 0;
+	default:
+		return EOPNOTSUPP;
 	}
-	splx(s);
-	return (error);
 }
 
 /*---------------------------------------------------------------------------*

Reply via email to