Simplify activation routines: don't call mii_activate(), it's a

no-op.  Don't block interrupts, if_deactivate() does it.
Compile-tested, only.
This commit is contained in:
dyoung 2009-09-15 19:20:29 +00:00
parent 662dfba47d
commit b8695aecbf
3 changed files with 16 additions and 46 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: elink3.c,v 1.128 2009/09/05 12:30:59 tsutsui Exp $ */
/* $NetBSD: elink3.c,v 1.129 2009/09/15 19:20:29 dyoung Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.128 2009/09/05 12:30:59 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.129 2009/09/15 19:20:29 dyoung Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -2002,24 +2002,14 @@ int
ep_activate(device_t self, enum devact act)
{
struct ep_softc *sc = device_private(self);
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
int error = 0, s;
s = splnet();
switch (act) {
case DVACT_ACTIVATE:
error = EOPNOTSUPP;
break;
case DVACT_DEACTIVATE:
if (sc->ep_flags & ELINK_FLAGS_MII)
mii_activate(&sc->sc_mii, act, MII_PHY_ANY,
MII_OFFSET_ANY);
if_deactivate(ifp);
break;
if_deactivate(&sc->sc_ethercom.ec_if);
return 0;
default:
return EOPNOTSUPP;
}
splx(s);
return (error);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: elinkxl.c,v 1.108 2009/09/05 14:19:30 tsutsui Exp $ */
/* $NetBSD: elinkxl.c,v 1.109 2009/09/15 19:20:30 dyoung Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.108 2009/09/05 14:19:30 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.109 2009/09/15 19:20:30 dyoung Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -1679,24 +1679,14 @@ int
ex_activate(device_t self, enum devact act)
{
struct ex_softc *sc = device_private(self);
int s, error = 0;
s = splnet();
switch (act) {
case DVACT_ACTIVATE:
error = EOPNOTSUPP;
break;
case DVACT_DEACTIVATE:
if (sc->ex_conf & EX_CONF_MII)
mii_activate(&sc->ex_mii, act, MII_PHY_ANY,
MII_OFFSET_ANY);
if_deactivate(&sc->sc_ethercom.ec_if);
break;
return 0;
default:
return EOPNOTSUPP;
}
splx(s);
return (error);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: i82557.c,v 1.129 2009/03/16 12:13:04 tsutsui Exp $ */
/* $NetBSD: i82557.c,v 1.130 2009/09/15 19:20:30 dyoung Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.129 2009/03/16 12:13:04 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.130 2009/09/15 19:20:30 dyoung Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -2482,24 +2482,14 @@ int
fxp_activate(device_t self, enum devact act)
{
struct fxp_softc *sc = device_private(self);
int s, error = 0;
s = splnet();
switch (act) {
case DVACT_ACTIVATE:
error = EOPNOTSUPP;
break;
case DVACT_DEACTIVATE:
if (sc->sc_flags & FXPF_MII)
mii_activate(&sc->sc_mii, act, MII_PHY_ANY,
MII_OFFSET_ANY);
if_deactivate(&sc->sc_ethercom.ec_if);
break;
return 0;
default:
return EOPNOTSUPP;
}
splx(s);
return (error);
}
/*