Module Name: src
Committed By: riastradh
Date: Sun Jul 29 02:07:33 UTC 2018
Modified Files:
src/sys/dev/usb: if_zyd.c
Log Message:
Use callout_halt and usb_rem_task_wait in zyd(4) detach.
Also comment on sketchiness in zyd_newstate that is beyond my scope
right now.
To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/if_zyd.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_zyd.c
diff -u src/sys/dev/usb/if_zyd.c:1.48 src/sys/dev/usb/if_zyd.c:1.49
--- src/sys/dev/usb/if_zyd.c:1.48 Tue Jun 26 06:48:02 2018
+++ src/sys/dev/usb/if_zyd.c Sun Jul 29 02:07:33 2018
@@ -1,5 +1,5 @@
/* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */
-/* $NetBSD: if_zyd.c,v 1.48 2018/06/26 06:48:02 msaitoh Exp $ */
+/* $NetBSD: if_zyd.c,v 1.49 2018/07/29 02:07:33 riastradh Exp $ */
/*-
* Copyright (c) 2006 by Damien Bergamini <[email protected]>
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.48 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.49 2018/07/29 02:07:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -466,9 +466,9 @@ zyd_detach(device_t self, int flags)
s = splusb();
zyd_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);
/* Abort, etc. done by zyd_stop */
zyd_close_pipes(sc);
@@ -761,6 +761,11 @@ zyd_newstate(struct ieee80211com *ic, en
if (!sc->attached)
return ENXIO;
+ /*
+ * 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);