? awi.diff ? awi.diff.1 ? o Index: awi.c =================================================================== RCS file: /cvsroot/src/sys/dev/ic/awi.c,v retrieving revision 1.102 diff -u -p -u -r1.102 awi.c --- awi.c 5 Jul 2024 04:31:51 -0000 1.102 +++ awi.c 30 Dec 2024 20:27:23 -0000 @@ -140,6 +140,8 @@ static int awi_send_mgmt(struct ieee802 int); static struct mbuf *awi_ether_encap(struct awi_softc *, struct mbuf *); static struct mbuf *awi_ether_modcap(struct awi_softc *, struct mbuf *); +static bool awi_suspend(device_t, const pmf_qual_t *); +static bool awi_resume(device_t, const pmf_qual_t *); /* Unaligned little endian access */ #define LE_READ_2(p) \ @@ -191,6 +193,7 @@ awi_attach(struct awi_softc *sc) int s, i, error, nrate; int mword; enum ieee80211_phymode mode; + device_t self = sc->sc_dev; s = splnet(); sc->sc_busy = 1; @@ -198,18 +201,18 @@ awi_attach(struct awi_softc *sc) sc->sc_substate = AWI_ST_NONE; sc->sc_soft_ih = softint_establish(SOFTINT_NET, awi_softintr, sc); if (sc->sc_soft_ih == NULL) { - config_deactivate(sc->sc_dev); + config_deactivate(self); splx(s); return ENOMEM; } if ((error = awi_hw_init(sc)) != 0) { - config_deactivate(sc->sc_dev); + config_deactivate(self); splx(s); return error; } error = awi_init_mibs(sc); if (error != 0) { - config_deactivate(sc->sc_dev); + config_deactivate(self); splx(s); return error; } @@ -221,7 +224,7 @@ awi_attach(struct awi_softc *sc) ifp->if_init = awi_init; ifp->if_stop = awi_stop; IFQ_SET_READY(&ifp->if_snd); - memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); ic->ic_ifp = ifp; ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP; @@ -276,10 +279,11 @@ awi_attach(struct awi_softc *sc) if ((sc->sc_sdhook = shutdownhook_establish(awi_shutdown, sc)) == NULL) printf("%s: WARNING: unable to establish shutdown hook\n", ifp->if_xname); - if ((sc->sc_powerhook = - powerhook_establish(ifp->if_xname, awi_power, sc)) == NULL) - printf("%s: WARNING: unable to establish power hook\n", - ifp->if_xname); + + if (pmf_device_register(self, NULL, NULL)) + pmf_class_network_register(self, ifp); + else + aprint_error_dev(self, "couldn't establish power handler\n"); sc->sc_attached = 1; splx(s); @@ -310,7 +314,7 @@ awi_detach(struct awi_softc *sc) ieee80211_ifdetach(ic); if_detach(ifp); shutdownhook_disestablish(sc->sc_sdhook); - powerhook_disestablish(sc->sc_powerhook); + pmf_device_deregister(sc->sc_dev); softint_disestablish(sc->sc_soft_ih); splx(s); return 0; @@ -331,38 +335,6 @@ awi_activate(device_t self, enum devact } void -awi_power(int why, void *arg) -{ - struct awi_softc *sc = arg; - struct ifnet *ifp = &sc->sc_if; - int s; - int ocansleep; - - DPRINTF(("awi_power: %d\n", why)); - s = splnet(); - ocansleep = sc->sc_cansleep; - sc->sc_cansleep = 0; - switch (why) { - case PWR_SUSPEND: - case PWR_STANDBY: - awi_stop(ifp, 1); - break; - case PWR_RESUME: - if (ifp->if_flags & IFF_UP) { - awi_init(ifp); - awi_softintr(sc); /* make sure */ - } - break; - case PWR_SOFTSUSPEND: - case PWR_SOFTSTANDBY: - case PWR_SOFTRESUME: - break; - } - sc->sc_cansleep = ocansleep; - splx(s); -} - -void awi_shutdown(void *arg) { struct awi_softc *sc = arg; Index: awivar.h =================================================================== RCS file: /cvsroot/src/sys/dev/ic/awivar.h,v retrieving revision 1.28 diff -u -p -u -r1.28 awivar.h --- awivar.h 2 Feb 2017 10:05:35 -0000 1.28 +++ awivar.h 30 Dec 2024 20:27:23 -0000 @@ -85,7 +85,6 @@ struct awi_softc { void *sc_soft_ih; void *sc_sdhook; /* shutdown hook */ - void *sc_powerhook; /* power management hook */ unsigned int sc_attached:1, sc_enabled:1, sc_busy:1, @@ -141,7 +140,6 @@ struct awi_softc { int awi_attach(struct awi_softc *); int awi_detach(struct awi_softc *); int awi_activate(device_t, enum devact); -void awi_power(int, void *); void awi_shutdown(void *); int awi_intr(void *);