From e9774e1b179ec2eedc9ec274dddd9c21aec1846f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 27 Aug 2010 15:56:10 +0000 Subject: Have the em powerhook call the activate function, which does a way better job of taking the chip up and down. --- sys/dev/pci/if_em.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'sys/dev/pci/if_em.c') diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index eb14257cd78..afc810ed9c7 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.244 2010/08/08 12:53:16 kettenis Exp $ */ +/* $OpenBSD: if_em.c,v 1.245 2010/08/27 15:56:09 deraadt Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include @@ -170,8 +170,8 @@ void em_attach(struct device *, struct device *, void *); void em_defer_attach(struct device*); int em_detach(struct device *, int); int em_activate(struct device *, int); +void em_powerhook(int, void *); int em_intr(void *); -void em_power(int, void *); void em_start(struct ifnet *); int em_ioctl(struct ifnet *, u_long, caddr_t); void em_watchdog(struct ifnet *); @@ -507,7 +507,7 @@ em_attach(struct device *parent, struct device *self, void *aux) sc->hw.icp_xxxx_is_link_up = FALSE; INIT_DEBUGOUT("em_attach: end"); - sc->sc_powerhook = powerhook_establish(em_power, sc); + sc->sc_powerhook = powerhook_establish(em_powerhook, sc); return; err_mac_addr: @@ -520,19 +520,6 @@ err_pci: em_free_pci_resources(sc); } -void -em_power(int why, void *arg) -{ - struct em_softc *sc = (struct em_softc *)arg; - struct ifnet *ifp; - - if (why == PWR_RESUME) { - ifp = &sc->interface_data.ac_if; - if (ifp->if_flags & IFF_UP) - em_init(sc); - } -} - /********************************************************************* * Transmit entry point * @@ -1908,6 +1895,12 @@ em_activate(struct device *self, int act) return rv; } +void +em_powerhook(int why, void *arg) +{ + em_activate(arg, why); +} + /********************************************************************* * * Workaround for SmartSpeed on 82541 and 82547 controllers -- cgit v1.2.3