Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pcmcia Simplify device-activation hooks.
details: https://anonhg.NetBSD.org/src/rev/4554a776471d
branches: trunk
changeset: 749741:4554a776471d
user: dyoung <dyoung%NetBSD.org@localhost>
date: Sun Dec 06 23:05:06 2009 +0000
description:
Simplify device-activation hooks.
diffstat:
sys/dev/pcmcia/if_cnw.c | 16 +++++-----------
sys/dev/pcmcia/if_ray.c | 27 ++++++++++-----------------
sys/dev/pcmcia/isic_pcmcia.c | 16 +++++-----------
3 files changed, 20 insertions(+), 39 deletions(-)
diffs (136 lines):
diff -r 76d119f6ca3a -r 4554a776471d sys/dev/pcmcia/if_cnw.c
--- a/sys/dev/pcmcia/if_cnw.c Sun Dec 06 22:56:56 2009 +0000
+++ b/sys/dev/pcmcia/if_cnw.c Sun Dec 06 23:05:06 2009 +0000
@@ -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
diff -r 76d119f6ca3a -r 4554a776471d sys/dev/pcmcia/if_ray.c
--- a/sys/dev/pcmcia/if_ray.c Sun Dec 06 22:56:56 2009 +0000
+++ b/sys/dev/pcmcia/if_ray.c Sun Dec 06 23:05:06 2009 +0000
@@ -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)));
-
- s = splnet();
+
+ RAY_DPRINTF(("%s: activate\n", device_xname(self)));
+
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
diff -r 76d119f6ca3a -r 4554a776471d sys/dev/pcmcia/isic_pcmcia.c
--- a/sys/dev/pcmcia/isic_pcmcia.c Sun Dec 06 22:56:56 2009 +0000
+++ b/sys/dev/pcmcia/isic_pcmcia.c Sun Dec 06 23:05:06 2009 +0000
@@ -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);
}
/*---------------------------------------------------------------------------*
Home |
Main Index |
Thread Index |
Old Index