Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Fix usb_rem_task_wait API.
details: https://anonhg.NetBSD.org/src/rev/fcdfac6c2225
branches: trunk
changeset: 365138:fcdfac6c2225
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Aug 02 06:09:04 2018 +0000
description:
Fix usb_rem_task_wait API.
- Return whether it removed task from queue or not.
. True if it was on the queue and we intercepted it before it ran.
. False if we could not intercept it: either it wasn't queued,
or it already ran. (Up to caller to distinguish these cases.)
- Pass an optional interlock like callout_halt.
While here, simplify.
ok mrg@
diffstat:
sys/dev/usb/if_athn_usb.c | 10 +++--
sys/dev/usb/if_atu.c | 6 +-
sys/dev/usb/if_aue.c | 10 +++--
sys/dev/usb/if_axe.c | 7 ++-
sys/dev/usb/if_axen.c | 6 +-
sys/dev/usb/if_cue.c | 10 +++--
sys/dev/usb/if_otus.c | 6 +-
sys/dev/usb/if_rum.c | 6 +-
sys/dev/usb/if_run.c | 7 ++-
sys/dev/usb/if_smsc.c | 8 ++-
sys/dev/usb/if_udav.c | 10 +++--
sys/dev/usb/if_upgt.c | 10 +++--
sys/dev/usb/if_ural.c | 6 +-
sys/dev/usb/if_url.c | 10 +++--
sys/dev/usb/if_urtw.c | 9 ++--
sys/dev/usb/if_urtwn.c | 7 ++-
sys/dev/usb/if_zyd.c | 6 +-
sys/dev/usb/uatp.c | 6 +-
sys/dev/usb/usb.c | 89 ++++++++++++++++++++--------------------------
sys/dev/usb/usb_subr.c | 7 ++-
sys/dev/usb/usbdi.h | 5 +-
21 files changed, 125 insertions(+), 116 deletions(-)
diffs (truncated from 702 to 300 lines):
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_athn_usb.c
--- a/sys/dev/usb/if_athn_usb.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_athn_usb.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_athn_usb.c,v 1.28 2018/07/29 01:59:56 riastradh Exp $ */
+/* $NetBSD: if_athn_usb.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $ */
/* $OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $ */
/*-
@@ -22,7 +22,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.28 2018/07/29 01:59:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -335,7 +335,8 @@
athn_usb_free_tx_cmd(usc);
athn_usb_free_tx_msg(usc);
athn_usb_close_pipes(usc);
- usb_rem_task_wait(usc->usc_udev, &usc->usc_task, USB_TASKQ_DRIVER);
+ usb_rem_task_wait(usc->usc_udev, &usc->usc_task, USB_TASKQ_DRIVER,
+ NULL);
cv_destroy(&usc->usc_cmd_cv);
cv_destroy(&usc->usc_msg_cv);
@@ -501,7 +502,8 @@
athn_usb_wait_async(usc);
- usb_rem_task_wait(usc->usc_udev, &usc->usc_task, USB_TASKQ_DRIVER);
+ usb_rem_task_wait(usc->usc_udev, &usc->usc_task, USB_TASKQ_DRIVER,
+ NULL);
/* Abort Tx/Rx pipes. */
athn_usb_abort_pipes(usc);
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_atu.c
--- a/sys/dev/usb/if_atu.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_atu.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_atu.c,v 1.62 2018/07/29 02:00:07 riastradh Exp $ */
+/* $NetBSD: if_atu.c,v 1.63 2018/08/02 06:09:04 riastradh Exp $ */
/* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
/*
* Copyright (c) 2003, 2004
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.62 2018/07/29 02:00:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.63 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2235,7 +2235,7 @@
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
ifp->if_timer = 0;
- usb_rem_task_wait(sc->atu_udev, &sc->sc_task, USB_TASKQ_DRIVER);
+ usb_rem_task_wait(sc->atu_udev, &sc->sc_task, USB_TASKQ_DRIVER, NULL);
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
/* Stop transfers. */
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_aue.c
--- a/sys/dev/usb/if_aue.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_aue.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aue.c,v 1.144 2018/07/29 02:00:17 riastradh Exp $ */
+/* $NetBSD: if_aue.c,v 1.145 2018/08/02 06:09:04 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.144 2018/07/29 02:00:17 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.145 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -894,8 +894,10 @@
* deactivation guaranteed to have already happened?
*/
callout_halt(&sc->aue_stat_ch, NULL);
- usb_rem_task_wait(sc->aue_udev, &sc->aue_tick_task, USB_TASKQ_DRIVER);
- usb_rem_task_wait(sc->aue_udev, &sc->aue_stop_task, USB_TASKQ_DRIVER);
+ usb_rem_task_wait(sc->aue_udev, &sc->aue_tick_task, USB_TASKQ_DRIVER,
+ NULL);
+ usb_rem_task_wait(sc->aue_udev, &sc->aue_stop_task, USB_TASKQ_DRIVER,
+ NULL);
sc->aue_closing = 1;
cv_signal(&sc->aue_domc);
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_axe.c
--- a/sys/dev/usb/if_axe.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_axe.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axe.c,v 1.91 2018/07/29 02:00:27 riastradh Exp $ */
+/* $NetBSD: if_axe.c,v 1.92 2018/08/02 06:09:04 riastradh Exp $ */
/* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
/*
@@ -87,7 +87,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.91 2018/07/29 02:00:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.92 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1112,7 +1112,8 @@
usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_INTR]);
callout_halt(&sc->axe_stat_ch, NULL);
- usb_rem_task_wait(sc->axe_udev, &sc->axe_tick_task, USB_TASKQ_DRIVER);
+ usb_rem_task_wait(sc->axe_udev, &sc->axe_tick_task, USB_TASKQ_DRIVER,
+ NULL);
s = splusb();
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_axen.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axen.c,v 1.15 2018/07/29 02:00:38 riastradh Exp $ */
+/* $NetBSD: if_axen.c,v 1.16 2018/08/02 06:09:04 riastradh Exp $ */
/* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */
/*
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.15 2018/07/29 02:00:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.16 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -829,7 +829,7 @@
callout_halt(&sc->axen_stat_ch, NULL);
usb_rem_task_wait(sc->axen_udev, &sc->axen_tick_task,
- USB_TASKQ_DRIVER);
+ USB_TASKQ_DRIVER, NULL);
s = splusb();
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_cue.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cue.c,v 1.79 2018/07/29 02:00:48 riastradh Exp $ */
+/* $NetBSD: if_cue.c,v 1.80 2018/08/02 06:09:04 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.79 2018/07/29 02:00:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.80 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -579,8 +579,10 @@
* deactivation guaranteed to have already happened?
*/
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);
+ usb_rem_task_wait(sc->cue_udev, &sc->cue_tick_task, USB_TASKQ_DRIVER,
+ NULL);
+ usb_rem_task_wait(sc->cue_udev, &sc->cue_stop_task, USB_TASKQ_DRIVER,
+ NULL);
if (!sc->cue_attached) {
/* Detached before attached finished, so just bail out. */
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_otus.c
--- a/sys/dev/usb/if_otus.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_otus.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_otus.c,v 1.34 2018/07/29 02:00:59 riastradh Exp $ */
+/* $NetBSD: if_otus.c,v 1.35 2018/08/02 06:09:04 riastradh Exp $ */
/* $OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.34 2018/07/29 02:00:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.35 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -701,7 +701,7 @@
if (ifp != NULL) /* Failed to attach properly */
otus_stop(ifp);
- usb_rem_task_wait(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER);
+ usb_rem_task_wait(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER, NULL);
callout_destroy(&sc->sc_scan_to);
callout_destroy(&sc->sc_calib_to);
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_rum.c
--- a/sys/dev/usb/if_rum.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_rum.c Thu Aug 02 06:09:04 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.62 2018/07/29 02:01:11 riastradh Exp $ */
+/* $NetBSD: if_rum.c,v 1.63 2018/08/02 06:09:04 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.62 2018/07/29 02:01:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.63 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -498,7 +498,7 @@
rum_stop(ifp, 1);
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);
+ usb_rem_task_wait(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER, NULL);
bpf_detach(ifp);
ieee80211_ifdetach(ic); /* free all nodes */
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_run.c
--- a/sys/dev/usb/if_run.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_run.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_run.c,v 1.28 2018/07/29 02:01:22 riastradh Exp $ */
+/* $NetBSD: if_run.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $ */
/* $OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.28 2018/07/29 02:01:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.29 2018/08/02 06:09:04 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -762,7 +762,8 @@
run_stop(ifp, 0);
callout_halt(&sc->scan_to, NULL);
callout_halt(&sc->calib_to, NULL);
- usb_rem_task_wait(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER);
+ usb_rem_task_wait(sc->sc_udev, &sc->sc_task, USB_TASKQ_DRIVER,
+ NULL);
}
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_smsc.c
--- a/sys/dev/usb/if_smsc.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_smsc.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_smsc.c,v 1.35 2018/07/29 02:01:32 riastradh Exp $ */
+/* $NetBSD: if_smsc.c,v 1.36 2018/08/02 06:09:04 riastradh Exp $ */
/* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
/* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -1149,8 +1149,10 @@
if (sc->sc_ep[SMSC_ENDPT_INTR] != NULL)
usbd_abort_pipe(sc->sc_ep[SMSC_ENDPT_INTR]);
- 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);
+ usb_rem_task_wait(sc->sc_udev, &sc->sc_tick_task, USB_TASKQ_DRIVER,
+ NULL);
+ usb_rem_task_wait(sc->sc_udev, &sc->sc_stop_task, USB_TASKQ_DRIVER,
+ NULL);
s = splusb();
diff -r 54546e706395 -r fcdfac6c2225 sys/dev/usb/if_udav.c
--- a/sys/dev/usb/if_udav.c Thu Aug 02 04:28:56 2018 +0000
+++ b/sys/dev/usb/if_udav.c Thu Aug 02 06:09:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_udav.c,v 1.54 2018/07/29 02:01:43 riastradh Exp $ */
+/* $NetBSD: if_udav.c,v 1.55 2018/08/02 06:09:04 riastradh Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
Home |
Main Index |
Thread Index |
Old Index