Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Use callout_halt and usb_rem_task_wait in rum(4)...



details:   https://anonhg.NetBSD.org/src/rev/46080a930115
branches:  trunk
changeset: 365043:46080a930115
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 29 02:01:11 2018 +0000

description:
Use callout_halt and usb_rem_task_wait in rum(4) detach.

Also comment on sketchiness in rum_newstate that is beyond my scope
right now.

squash! 815cfdcb30208ae2d1cffe19b1cd4ef85ab19f3c

diffstat:

 sys/dev/usb/if_rum.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r 584e172399ed -r 46080a930115 sys/dev/usb/if_rum.c
--- a/sys/dev/usb/if_rum.c      Sun Jul 29 02:00:59 2018 +0000
+++ b/sys/dev/usb/if_rum.c      Sun Jul 29 02:01:11 2018 +0000
@@ -1,5 +1,5 @@
 /*     $OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $      */
-/*     $NetBSD: if_rum.c,v 1.61 2018/06/26 06:48:02 msaitoh Exp $      */
+/*     $NetBSD: if_rum.c,v 1.62 2018/07/29 02:01:11 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini%free.fr@localhost>
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.61 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.62 2018/07/29 02:01:11 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -496,9 +496,9 @@
        s = splusb();
 
        rum_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); /* free all nodes */
@@ -735,6 +735,11 @@
 {
        struct rum_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);



Home | Main Index | Thread Index | Old Index