Simplify device-activation hooks.

This commit is contained in:
dyoung 2009-12-06 23:05:06 +00:00
parent c2a519975e
commit 903d1910d3
3 changed files with 18 additions and 37 deletions

View File

@ -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 @@ int
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

View File

@ -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 @@ fail:
}
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

View File

@ -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 @@ isic_pcmcia_detach(device_t self, int flags)
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);
}
/*---------------------------------------------------------------------------*