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 cue(4).



details:   https://anonhg.NetBSD.org/src/rev/6038618e2ae0
branches:  trunk
changeset: 365041:6038618e2ae0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 29 02:00:48 2018 +0000

description:
Use callout_halt and usb_rem_task_wait in cue(4).

diffstat:

 sys/dev/usb/if_cue.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r 73b04bda1545 -r 6038618e2ae0 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c      Sun Jul 29 02:00:38 2018 +0000
+++ b/sys/dev/usb/if_cue.c      Sun Jul 29 02:00:48 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cue.c,v 1.78 2018/06/26 06:48:02 msaitoh Exp $      */
+/*     $NetBSD: if_cue.c,v 1.79 2018/07/29 02:00:48 riastradh Exp $    */
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *     Bill Paul <wpaul%ee.columbia.edu@localhost>.  All rights reserved.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.78 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.79 2018/07/29 02:00:48 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -571,13 +571,16 @@
 
        DPRINTFN(2,("%s: %s: enter\n", device_xname(sc->cue_dev), __func__));
 
-       callout_stop(&sc->cue_stat_ch);
        /*
-        * Remove any pending task.  It cannot be executing because it run
-        * in the same thread as detach.
+        * XXX Halting callout guarantees no more tick tasks.  What
+        * guarantees no more stop tasks?  What guarantees no more
+        * calls to cue_send?  Don't we need to wait for if_detach or
+        * something?  Should we set sc->cue_dying here?  Is device
+        * deactivation guaranteed to have already happened?
         */
-       usb_rem_task(sc->cue_udev, &sc->cue_tick_task);
-       usb_rem_task(sc->cue_udev, &sc->cue_stop_task);
+       callout_halt(&sc->cue_stat_ch, NULL);
+       usb_rem_task_wait(sc->cue_udev, &sc->cue_tick_task, USB_TASKQ_DRIVER);
+       usb_rem_task_wait(sc->cue_udev, &sc->cue_stop_task, USB_TASKQ_DRIVER);
 
        if (!sc->cue_attached) {
                /* Detached before attached finished, so just bail out. */



Home | Main Index | Thread Index | Old Index