diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/dc.c | 37 | ||||
-rw-r--r-- | sys/dev/ic/dcreg.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/if_dc_pci.c | 27 |
3 files changed, 27 insertions, 40 deletions
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 705e0dda779..7c4383f7507 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.116 2010/08/05 07:57:04 deraadt Exp $ */ +/* $OpenBSD: dc.c,v 1.117 2010/08/27 19:54:02 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -130,7 +130,7 @@ #include <dev/ic/dcreg.h> int dc_intr(void *); -void dc_power(int, void *); +void dc_powerhook(int, void *); struct dc_type *dc_devtype(void *); int dc_newbuf(struct dc_softc *, int, struct mbuf *); int dc_encap(struct dc_softc *, struct mbuf *, u_int32_t *); @@ -1814,7 +1814,7 @@ hasmac: if_attach(ifp); ether_ifattach(ifp); - sc->sc_pwrhook = powerhook_establish(dc_power, sc); + sc->sc_pwrhook = powerhook_establish(dc_powerhook, sc); fail: return; @@ -3124,22 +3124,31 @@ dc_stop(struct dc_softc *sc, int softonly) BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } -void -dc_power(int why, void *arg) +int +dc_activate(struct device *self, int act) { - struct dc_softc *sc = arg; - struct ifnet *ifp; - int s; + struct dc_softc *sc = (struct dc_softc *)self; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; - s = splnet(); - if (why != PWR_RESUME) - dc_stop(sc, 0); - else { - ifp = &sc->sc_arpcom.ac_if; + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + dc_stop(sc, 0); + config_activate_children(self, act); + break; + case DVACT_RESUME: + config_activate_children(self, act); if (ifp->if_flags & IFF_UP) dc_init(sc); + break; } - splx(s); + return (0); +} + +void +dc_powerhook(int why, void *arg) +{ + dc_activate(arg, why); } int diff --git a/sys/dev/ic/dcreg.h b/sys/dev/ic/dcreg.h index 79b84e8c5f8..57bd6de0bef 100644 --- a/sys/dev/ic/dcreg.h +++ b/sys/dev/ic/dcreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dcreg.h,v 1.46 2010/08/05 07:57:04 deraadt Exp $ */ +/* $OpenBSD: dcreg.h,v 1.47 2010/08/27 19:54:02 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1048,6 +1048,7 @@ struct dc_eblock_reset { extern void dc_attach(struct dc_softc *); extern int dc_detach(struct dc_softc *); +extern int dc_activate(struct device *, int); extern int dc_intr(void *); void dc_init(void *); diff --git a/sys/dev/pci/if_dc_pci.c b/sys/dev/pci/if_dc_pci.c index 5c485a2a51d..bf8dd577537 100644 --- a/sys/dev/pci/if_dc_pci.c +++ b/sys/dev/pci/if_dc_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dc_pci.c,v 1.66 2010/08/05 07:57:05 deraadt Exp $ */ +/* $OpenBSD: if_dc_pci.c,v 1.67 2010/08/27 19:54:03 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -125,7 +125,6 @@ struct dc_type dc_devs[] = { int dc_pci_match(struct device *, void *, void *); void dc_pci_attach(struct device *, struct device *, void *); int dc_pci_detach(struct device *, int); -int dc_pci_activate(struct device *, int); void dc_pci_acpi(struct device *, void *); struct dc_pci_softc { @@ -574,29 +573,7 @@ dc_pci_detach(struct device *self, int flags) return (0); } -int -dc_pci_activate(struct device *self, int act) -{ - struct dc_pci_softc *psc = (void *)self; - struct dc_softc *sc = &psc->psc_softc; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; - - switch (act) { - case DVACT_SUSPEND: - if (ifp->if_flags & IFF_RUNNING) - dc_stop(sc, 0); - config_activate_children(self, act); - break; - case DVACT_RESUME: - config_activate_children(self, act); - if (ifp->if_flags & IFF_UP) - dc_init(sc); - break; - } - return (0); -} - struct cfattach dc_pci_ca = { sizeof(struct dc_softc), dc_pci_match, dc_pci_attach, dc_pci_detach, - dc_pci_activate + dc_activate }; |