Module Name: src Committed By: riastradh Date: Mon Aug 20 04:50:56 UTC 2018
Modified Files: src/sys/dev/pci: if_wpi.c if_wpivar.h Log Message: Suspend the getrfkill thread while we're suspended. Otherwise it tries to futz with device registers, which doesn't work, and who knows, maybe is bad. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/if_wpi.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_wpivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/if_wpi.c diff -u src/sys/dev/pci/if_wpi.c:1.81 src/sys/dev/pci/if_wpi.c:1.82 --- src/sys/dev/pci/if_wpi.c:1.81 Mon Aug 20 02:33:17 2018 +++ src/sys/dev/pci/if_wpi.c Mon Aug 20 04:50:56 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wpi.c,v 1.81 2018/08/20 02:33:17 riastradh Exp $ */ +/* $NetBSD: if_wpi.c,v 1.82 2018/08/20 04:50:56 riastradh Exp $ */ /*- * Copyright (c) 2006, 2007 @@ -18,7 +18,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.81 2018/08/20 02:33:17 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.82 2018/08/20 04:50:56 riastradh Exp $"); /* * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters. @@ -229,6 +229,8 @@ wpi_attach(device_t parent __unused, dev } mutex_init(&sc->sc_rsw_mtx, MUTEX_DEFAULT, IPL_NONE); cv_init(&sc->sc_rsw_cv, "wpirsw"); + sc->sc_rsw_suspend = false; + sc->sc_rsw_suspended = false; if (kthread_create(PRI_NONE, 0, NULL, wpi_rsw_thread, sc, &sc->sc_rsw_lwp, "%s", device_xname(self))) { aprint_error_dev(self, "couldn't create switch thread\n"); @@ -3268,6 +3270,10 @@ wpi_init(struct ifnet *ifp) error = EBUSY; goto fail1; } + sc->sc_rsw_suspend = false; + cv_broadcast(&sc->sc_rsw_cv); + while (sc->sc_rsw_suspend) + cv_wait(&sc->sc_rsw_cv, &sc->sc_rsw_mtx); mutex_exit(&sc->sc_rsw_mtx); /* wait for thermal sensors to calibrate */ @@ -3318,6 +3324,14 @@ wpi_stop(struct ifnet *ifp, int disable) ieee80211_new_state(ic, IEEE80211_S_INIT, -1); + /* suspend rfkill test thread */ + mutex_enter(&sc->sc_rsw_mtx); + sc->sc_rsw_suspend = true; + cv_broadcast(&sc->sc_rsw_cv); + while (!sc->sc_rsw_suspended) + cv_wait(&sc->sc_rsw_cv, &sc->sc_rsw_mtx); + mutex_exit(&sc->sc_rsw_mtx); + /* disable interrupts */ WPI_WRITE(sc, WPI_MASK, 0); WPI_WRITE(sc, WPI_INTR, WPI_INTR_MASK); @@ -3463,7 +3477,14 @@ wpi_rsw_thread(void *arg) mutex_exit(&sc->sc_rsw_mtx); kthread_exit(0); } + if (sc->sc_rsw_suspend) { + sc->sc_rsw_suspended = true; + cv_broadcast(&sc->sc_rsw_cv); + while (sc->sc_rsw_suspend || sc->sc_dying) + cv_wait(&sc->sc_rsw_cv, &sc->sc_rsw_mtx); + sc->sc_rsw_suspended = false; + cv_broadcast(&sc->sc_rsw_cv); + } wpi_getrfkill(sc); } } - Index: src/sys/dev/pci/if_wpivar.h diff -u src/sys/dev/pci/if_wpivar.h:1.21 src/sys/dev/pci/if_wpivar.h:1.22 --- src/sys/dev/pci/if_wpivar.h:1.21 Thu Feb 2 10:05:35 2017 +++ src/sys/dev/pci/if_wpivar.h Mon Aug 20 04:50:56 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wpivar.h,v 1.21 2017/02/02 10:05:35 nonaka Exp $ */ +/* $NetBSD: if_wpivar.h,v 1.22 2018/08/20 04:50:56 riastradh Exp $ */ /*- * Copyright (c) 2006 @@ -197,5 +197,7 @@ struct wpi_softc { struct lwp *sc_rsw_lwp; struct kmutex sc_rsw_mtx; struct kcondvar sc_rsw_cv; - int sc_dying; + bool sc_dying; + bool sc_rsw_suspend; + bool sc_rsw_suspended; };