diff options
-rw-r--r-- | sys/dev/ic/xl.c | 42 | ||||
-rw-r--r-- | sys/dev/ic/xlreg.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/if_xl_pci.c | 31 |
3 files changed, 31 insertions, 45 deletions
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index ad2a1c1ede4..751501f438d 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.91 2010/08/12 14:21:55 kettenis Exp $ */ +/* $OpenBSD: xl.c,v 1.92 2010/08/27 15:43:41 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -193,26 +193,36 @@ int xl_miibus_readreg(struct device *, int, int); void xl_miibus_writereg(struct device *, int, int, int); void xl_miibus_statchg(struct device *); -void xl_power(int, void *); +void xl_powerhook(int, void *); -void -xl_power(int why, void *arg) +int +xl_activate(struct device *self, int act) { - struct xl_softc *sc = arg; - struct ifnet *ifp; - int s; + struct xl_softc *sc = (struct xl_softc *)self; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; - s = splnet(); - if (why != PWR_RESUME) - xl_stop(sc); - else { - ifp = &sc->sc_arpcom.ac_if; - if (ifp->if_flags & IFF_UP) { + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) { xl_reset(sc); - xl_init(sc); + xl_stop(sc); } + config_activate_children(self, act); + break; + case DVACT_RESUME: + xl_reset(sc); + config_activate_children(self, act); + if (ifp->if_flags & IFF_UP) + xl_init(sc); + break; } - splx(s); + return (0); +} + +void +xl_powerhook(int why, void *arg) +{ + xl_activate(arg, why); } /* @@ -2673,7 +2683,7 @@ xl_attach(struct xl_softc *sc) ether_ifattach(ifp); sc->sc_sdhook = shutdownhook_establish(xl_shutdown, sc); - sc->sc_pwrhook = powerhook_establish(xl_power, sc); + sc->sc_pwrhook = powerhook_establish(xl_powerhook, sc); } int diff --git a/sys/dev/ic/xlreg.h b/sys/dev/ic/xlreg.h index 9939cebe734..406481de57c 100644 --- a/sys/dev/ic/xlreg.h +++ b/sys/dev/ic/xlreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xlreg.h,v 1.22 2010/08/12 14:21:55 kettenis Exp $ */ +/* $OpenBSD: xlreg.h,v 1.23 2010/08/27 15:43:41 deraadt Exp $ */ /* * Copyright (c) 1997, 1998 @@ -746,3 +746,4 @@ extern int xl_detach(struct xl_softc *); void xl_init(void *); void xl_stop(struct xl_softc *); void xl_reset(struct xl_softc *); +int xl_activate(struct device *, int); diff --git a/sys/dev/pci/if_xl_pci.c b/sys/dev/pci/if_xl_pci.c index 15bc79c4700..13ffc4dacb0 100644 --- a/sys/dev/pci/if_xl_pci.c +++ b/sys/dev/pci/if_xl_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl_pci.c,v 1.31 2010/08/12 14:21:55 kettenis Exp $ */ +/* $OpenBSD: if_xl_pci.c,v 1.32 2010/08/27 15:43:42 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -91,7 +91,7 @@ int xl_pci_match(struct device *, void *, void *); void xl_pci_attach(struct device *, struct device *, void *); int xl_pci_detach(struct device *, int); -int xl_pci_activate(struct device *, int); +int xl_activate(struct device *, int); void xl_pci_intr_ack(struct xl_softc *); struct xl_pci_softc { @@ -103,7 +103,7 @@ struct xl_pci_softc { struct cfattach xl_pci_ca = { sizeof(struct xl_pci_softc), xl_pci_match, xl_pci_attach, xl_pci_detach, - xl_pci_activate + xl_activate }; const struct pci_matchid xl_pci_devices[] = { @@ -337,31 +337,6 @@ xl_pci_detach(struct device *self, int flags) return (0); } -int -xl_pci_activate(struct device *self, int act) -{ - struct xl_pci_softc *psc = (void *)self; - struct xl_softc *sc = &psc->psc_softc; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; - - switch (act) { - case DVACT_SUSPEND: - if (ifp->if_flags & IFF_RUNNING) { - xl_reset(sc); - xl_stop(sc); - } - config_activate_children(self, act); - break; - case DVACT_RESUME: - xl_reset(sc); - config_activate_children(self, act); - if (ifp->if_flags & IFF_UP) - xl_init(sc); - break; - } - return (0); -} - void xl_pci_intr_ack(struct xl_softc *sc) { |