From 8e99b7c1fee6c34c77dfa1f5e507c1c07b32ad4d Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 27 Aug 2010 20:09:02 +0000 Subject: Move the guts of the powerhook function into the activate function and make it stop calling the powerhook function; then make the powerhook function call activate. This basically inverts the whole goop. ok kettenis --- sys/dev/pci/if_ipw.c | 25 ++++++++++--------------- sys/dev/pci/if_iwi.c | 25 ++++++++++--------------- sys/dev/pci/if_iwn.c | 25 ++++++++++--------------- sys/dev/pci/if_wpi.c | 25 ++++++++++--------------- 4 files changed, 40 insertions(+), 60 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index 2a9d2474433..797eb156847 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.91 2010/08/27 17:08:00 jsg Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.92 2010/08/27 20:09:01 deraadt Exp $ */ /*- * Copyright (c) 2004-2008 @@ -66,7 +66,7 @@ int ipw_match(struct device *, void *, void *); void ipw_attach(struct device *, struct device *, void *); int ipw_activate(struct device *, int); void ipw_resume(void *, void *); -void ipw_power(int, void *); +void ipw_powerhook(int, void *); int ipw_dma_alloc(struct ipw_softc *); void ipw_release(struct ipw_softc *); int ipw_media_change(struct ifnet *); @@ -277,7 +277,7 @@ ipw_attach(struct device *parent, struct device *self, void *aux) ic->ic_send_mgmt = ipw_send_mgmt; ieee80211_media_init(ifp, ipw_media_change, ipw_media_status); - sc->powerhook = powerhook_establish(ipw_power, sc); + sc->powerhook = powerhook_establish(ipw_powerhook, sc); #if NBPFILTER > 0 bpfattach(&sc->sc_drvbpf, ifp, DLT_IEEE802_11_RADIO, @@ -316,22 +316,11 @@ ipw_activate(struct device *self, int act) void ipw_resume(void *arg1, void *arg2) { - ipw_power(PWR_RESUME, arg1); -} - -void -ipw_power(int why, void *arg) -{ - struct ipw_softc *sc = arg; + struct ipw_softc *sc = arg1; struct ifnet *ifp = &sc->sc_ic.ic_if; pcireg_t data; int s; - if (why != PWR_RESUME) { - ipw_stop(ifp, 0); - return; - } - /* clear device specific PCI configuration register 0x41 */ data = pci_conf_read(sc->sc_pct, sc->sc_pcitag, 0x40); data &= ~0x0000ff00; @@ -350,6 +339,12 @@ ipw_power(int why, void *arg) splx(s); } +void +ipw_powerhook(int why, void *arg) +{ + ipw_activate(arg, why); +} + int ipw_dma_alloc(struct ipw_softc *sc) { diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 414f9d6f557..481d4e18924 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.108 2010/08/27 17:08:00 jsg Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.109 2010/08/27 20:09:01 deraadt Exp $ */ /*- * Copyright (c) 2004-2008 @@ -76,7 +76,7 @@ int iwi_match(struct device *, void *, void *); void iwi_attach(struct device *, struct device *, void *); int iwi_activate(struct device *, int); void iwi_resume(void *, void *); -void iwi_power(int, void *); +void iwi_powerhook(int, void *); int iwi_alloc_cmd_ring(struct iwi_softc *, struct iwi_cmd_ring *); void iwi_reset_cmd_ring(struct iwi_softc *, struct iwi_cmd_ring *); void iwi_free_cmd_ring(struct iwi_softc *, struct iwi_cmd_ring *); @@ -313,7 +313,7 @@ iwi_attach(struct device *parent, struct device *self, void *aux) ic->ic_send_mgmt = iwi_send_mgmt; ieee80211_media_init(ifp, iwi_media_change, iwi_media_status); - sc->powerhook = powerhook_establish(iwi_power, sc); + sc->powerhook = powerhook_establish(iwi_powerhook, sc); #if NBPFILTER > 0 bpfattach(&sc->sc_drvbpf, ifp, DLT_IEEE802_11_RADIO, @@ -358,22 +358,11 @@ iwi_activate(struct device *self, int act) void iwi_resume(void *arg1, void *arg2) { - iwi_power(PWR_RESUME, arg1); -} - -void -iwi_power(int why, void *arg) -{ - struct iwi_softc *sc = arg; + struct iwi_softc *sc = arg1; struct ifnet *ifp = &sc->sc_ic.ic_if; pcireg_t data; int s; - if (why != PWR_RESUME) { - iwi_stop(ifp, 0); - return; - } - /* clear device specific PCI configuration register 0x41 */ data = pci_conf_read(sc->sc_pct, sc->sc_pcitag, 0x40); data &= ~0x0000ff00; @@ -392,6 +381,12 @@ iwi_power(int why, void *arg) splx(s); } +void +iwi_powerhook(int why, void *arg) +{ + iwi_activate(arg, why); +} + int iwi_alloc_cmd_ring(struct iwi_softc *sc, struct iwi_cmd_ring *ring) { diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index 15a95b7fd59..dc4d635065c 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.103 2010/08/27 17:08:00 jsg Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.104 2010/08/27 20:09:01 deraadt Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini @@ -107,7 +107,7 @@ void iwn_radiotap_attach(struct iwn_softc *); int iwn_detach(struct device *, int); int iwn_activate(struct device *, int); void iwn_resume(void *, void *); -void iwn_power(int, void *); +void iwn_powerhook(int, void *); int iwn_nic_lock(struct iwn_softc *); int iwn_eeprom_lock(struct iwn_softc *); int iwn_init_otprom(struct iwn_softc *); @@ -569,7 +569,7 @@ iwn_attach(struct device *parent, struct device *self, void *aux) #endif timeout_set(&sc->calib_to, iwn_calib_timeout, sc); - sc->powerhook = powerhook_establish(iwn_power, sc); + sc->powerhook = powerhook_establish(iwn_powerhook, sc); return; @@ -763,22 +763,11 @@ iwn_activate(struct device *self, int act) void iwn_resume(void *arg1, void *arg2) { - iwn_power(PWR_RESUME, arg1); -} - -void -iwn_power(int why, void *arg) -{ - struct iwn_softc *sc = arg; + struct iwn_softc *sc = arg1; struct ifnet *ifp = &sc->sc_ic.ic_if; pcireg_t reg; int s; - if (why != PWR_RESUME) { - iwn_stop(ifp, 0); - return; - } - /* Clear device-specific "PCI retry timeout" register (41h). */ reg = pci_conf_read(sc->sc_pct, sc->sc_pcitag, 0x40); reg &= ~0xff00; @@ -797,6 +786,12 @@ iwn_power(int why, void *arg) splx(s); } +void +iwn_powerhook(int why, void *arg) +{ + iwn_activate(arg, why); +} + int iwn_nic_lock(struct iwn_softc *sc) { diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index b7f47d4a139..94d18b1e075 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.107 2010/08/27 17:08:00 jsg Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.108 2010/08/27 20:09:01 deraadt Exp $ */ /*- * Copyright (c) 2006-2008 @@ -77,7 +77,7 @@ void wpi_radiotap_attach(struct wpi_softc *); int wpi_detach(struct device *, int); int wpi_activate(struct device *, int); void wpi_resume(void *, void *); -void wpi_power(int, void *); +void wpi_powerhook(int, void *); int wpi_nic_lock(struct wpi_softc *); int wpi_read_prom_data(struct wpi_softc *, uint32_t, void *, int); int wpi_dma_contig_alloc(bus_dma_tag_t, struct wpi_dma_info *, @@ -328,7 +328,7 @@ wpi_attach(struct device *parent, struct device *self, void *aux) #endif timeout_set(&sc->calib_to, wpi_calib_timeout, sc); - sc->powerhook = powerhook_establish(wpi_power, sc); + sc->powerhook = powerhook_establish(wpi_powerhook, sc); return; @@ -413,22 +413,11 @@ wpi_activate(struct device *self, int act) void wpi_resume(void *arg1, void *arg2) { - wpi_power(PWR_RESUME, arg1); -} - -void -wpi_power(int why, void *arg) -{ - struct wpi_softc *sc = arg; + struct wpi_softc *sc = arg1; struct ifnet *ifp = &sc->sc_ic.ic_if; pcireg_t reg; int s; - if (why != PWR_RESUME) { - wpi_stop(ifp, 0); - return; - } - /* Clear device-specific "PCI retry timeout" register (41h). */ reg = pci_conf_read(sc->sc_pct, sc->sc_pcitag, 0x40); reg &= ~0xff00; @@ -447,6 +436,12 @@ wpi_power(int why, void *arg) splx(s); } +void +wpi_powerhook(int why, void *arg) +{ + wpi_activate(arg, why); +} + int wpi_nic_lock(struct wpi_softc *sc) { -- cgit v1.2.3