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



details:   https://anonhg.NetBSD.org/src/rev/3658e262699c
branches:  trunk
changeset: 365055:3658e262699c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 29 02:08:17 2018 +0000

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

diffstat:

 sys/dev/usb/if_url.c |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r f1cb7cf6df4e -r 3658e262699c sys/dev/usb/if_url.c
--- a/sys/dev/usb/if_url.c      Sun Jul 29 02:08:07 2018 +0000
+++ b/sys/dev/usb/if_url.c      Sun Jul 29 02:08:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_url.c,v 1.58 2018/06/26 06:48:02 msaitoh Exp $      */
+/*     $NetBSD: if_url.c,v 1.59 2018/07/29 02:08:17 riastradh Exp $    */
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.58 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.59 2018/07/29 02:08:17 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -346,11 +346,18 @@
        if (!sc->sc_attached)
                return 0;
 
-       callout_stop(&sc->sc_stat_ch);
+       /*
+        * XXX Halting callout guarantees no more tick tasks.  What
+        * guarantees no more stop tasks?  What guarantees no more
+        * calls to url_send?  Don't we need to wait for if_detach or
+        * something?  Should set sc->sc_dying here?  Is device
+        * deactivation guaranteed to have already happened?
+        */
+       callout_halt(&sc->sc_stat_ch, NULL);
 
        /* Remove any pending tasks */
-       usb_rem_task(sc->sc_udev, &sc->sc_tick_task);
-       usb_rem_task(sc->sc_udev, &sc->sc_stop_task);
+       usb_rem_task_wait(sc->sc_udev, &sc->sc_tick_task, USB_TASKQ_DRIVER);
+       usb_rem_task_wait(sc->sc_udev, &sc->sc_stop_task, USB_TASKQ_DRIVER);
 
        s = splusb();
 



Home | Main Index | Thread Index | Old Index