Module Name: src Committed By: riastradh Date: Sun Jul 29 02:02:04 UTC 2018
Modified Files: src/sys/dev/usb: if_ural.c Log Message: Use callout_halt and usb_rem_task_wait(4) in ural(4) detach. Also comment on sketchiness in ural_newstate that is beyond my scope right now. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/dev/usb/if_ural.c 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/usb/if_ural.c diff -u src/sys/dev/usb/if_ural.c:1.55 src/sys/dev/usb/if_ural.c:1.56 --- src/sys/dev/usb/if_ural.c:1.55 Tue Jun 26 06:48:02 2018 +++ src/sys/dev/usb/if_ural.c Sun Jul 29 02:02:04 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ural.c,v 1.55 2018/06/26 06:48:02 msaitoh Exp $ */ +/* $NetBSD: if_ural.c,v 1.56 2018/07/29 02:02:04 riastradh Exp $ */ /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.55 2018/06/26 06:48:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.56 2018/07/29 02:02:04 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -534,9 +534,9 @@ ural_detach(device_t self, int flags) s = splusb(); ural_stop(ifp, 1); - usb_rem_task(sc->sc_udev, &sc->sc_task); - callout_stop(&sc->sc_scan_ch); - callout_stop(&sc->sc_amrr_ch); + callout_halt(&sc->sc_scan_ch, NULL); + callout_halt(&sc->sc_amrr_ch, NULL); + usb_rem_task_wait(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER); bpf_detach(ifp); ieee80211_ifdetach(ic); @@ -784,6 +784,11 @@ ural_newstate(struct ieee80211com *ic, e { struct ural_softc *sc = ic->ic_ifp->if_softc; + /* + * XXXSMP: This does not wait for the task, if it is in flight, + * to complete. If this code works at all, it must rely on the + * kernel lock to serialize with the USB task thread. + */ usb_rem_task(sc->sc_udev, &sc->sc_task); callout_stop(&sc->sc_scan_ch); callout_stop(&sc->sc_amrr_ch);