summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMasao Uebayashi <uebayasi@cvs.openbsd.org>2015-02-10 23:10:22 +0000
committerMasao Uebayashi <uebayasi@cvs.openbsd.org>2015-02-10 23:10:22 +0000
commit3d196cee8016d9003de99a31843be06b7ea56465 (patch)
treee4b219db57a134cfcafafe241edeba85b250c00b /sys/dev/usb
parenta2db6c9f05d7afa7eecdb540f399682931f665a4 (diff)
Convert timeout(9)/taskq(9) usages.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/dwc2/dwc2.c11
-rw-r--r--sys/dev/usb/dwc2/dwc2.h8
-rw-r--r--sys/dev/usb/dwc2/dwc2_coreintr.c4
-rw-r--r--sys/dev/usb/dwc2/dwc2_hcd.c13
-rw-r--r--sys/dev/usb/dwc2/dwc2var.h8
5 files changed, 25 insertions, 19 deletions
diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c
index f69253f17b3..06a6382017b 100644
--- a/sys/dev/usb/dwc2/dwc2.c
+++ b/sys/dev/usb/dwc2/dwc2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2.c,v 1.11 2015/02/10 14:34:14 uebayasi Exp $ */
+/* $OpenBSD: dwc2.c,v 1.12 2015/02/10 23:10:21 uebayasi Exp $ */
/* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */
/*-
@@ -553,7 +553,7 @@ dwc2_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
if (sc->sc_dying) {
xfer->status = status;
- timeout_stop(&xfer->timeout_handle);
+ timeout_del(&xfer->timeout_handle);
usb_transfer_complete(xfer);
return;
}
@@ -577,7 +577,7 @@ dwc2_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
xfer->hcflags |= UXFER_ABORTING;
xfer->status = status; /* make software ignore it */
- timeout_stop(&xfer->timeout_handle);
+ timeout_del(&xfer->timeout_handle);
/* XXXNH suboptimal */
TAILQ_FOREACH_SAFE(d, &sc->sc_complete, xnext, tmp) {
@@ -1656,7 +1656,8 @@ dw_timeout(void *arg)
{
struct delayed_work *dw = arg;
- taskq_enqueue(dw->dw_wq, &dw->work, NULL);
+ task_set(&dw->work, dw->dw_fn, arg);
+ task_add(dw->dw_wq, &dw->work);
}
void dwc2_host_hub_info(struct dwc2_hsotg *hsotg, void *context, int *hub_addr,
@@ -1778,7 +1779,7 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
}
qtd->urb = NULL;
- timeout_stop(&xfer->timeout_handle);
+ timeout_del(&xfer->timeout_handle);
KASSERT(mtx_owned(&hsotg->lock));
diff --git a/sys/dev/usb/dwc2/dwc2.h b/sys/dev/usb/dwc2/dwc2.h
index 6543b9a59f6..2c4223c5f43 100644
--- a/sys/dev/usb/dwc2/dwc2.h
+++ b/sys/dev/usb/dwc2/dwc2.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2.h,v 1.6 2015/02/10 14:34:14 uebayasi Exp $ */
+/* $OpenBSD: dwc2.h,v 1.7 2015/02/10 23:10:21 uebayasi Exp $ */
/* $NetBSD: dwc2.h,v 1.4 2014/12/23 16:20:06 macallan Exp $ */
/*-
@@ -213,18 +213,20 @@ struct delayed_work {
struct timeout dw_timer;
struct taskq *dw_wq;
+ void (*dw_fn)(struct task *);
};
static inline void
INIT_DELAYED_WORK(struct delayed_work *dw, void (*fn)(struct task *))
{
- timeout_init(&dw->dw_timer, CALLOUT_MPSAFE);
+ dw->dw_fn = fn;
+ timeout_set(&dw->dw_timer, dw_timeout, dw);
}
static inline void
queue_delayed_work(struct taskq *wq, struct delayed_work *dw, int j)
{
- timeout_reset(&dw->dw_timer, j, dw_timeout, dw);
+ timeout_add(&dw->dw_timer, j);
}
#endif
diff --git a/sys/dev/usb/dwc2/dwc2_coreintr.c b/sys/dev/usb/dwc2/dwc2_coreintr.c
index c0a592b3ba8..cef80f37f87 100644
--- a/sys/dev/usb/dwc2/dwc2_coreintr.c
+++ b/sys/dev/usb/dwc2/dwc2_coreintr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2_coreintr.c,v 1.4 2015/02/10 13:49:48 uebayasi Exp $ */
+/* $OpenBSD: dwc2_coreintr.c,v 1.5 2015/02/10 23:10:21 uebayasi Exp $ */
/* $NetBSD: dwc2_coreintr.c,v 1.8 2014/04/04 05:40:57 skrll Exp $ */
/*
@@ -305,7 +305,7 @@ static void dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg)
* scheduling.
*/
spin_unlock(&hsotg->lock);
- taskq_enqueue(hsotg->wq_otg, &hsotg->wf_otg, NULL);
+ task_add(hsotg->wq_otg, &hsotg->wf_otg);
spin_lock(&hsotg->lock);
/* Clear interrupt */
diff --git a/sys/dev/usb/dwc2/dwc2_hcd.c b/sys/dev/usb/dwc2/dwc2_hcd.c
index af250a546c3..e0a0850dc44 100644
--- a/sys/dev/usb/dwc2/dwc2_hcd.c
+++ b/sys/dev/usb/dwc2/dwc2_hcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2_hcd.c,v 1.7 2015/02/10 14:34:14 uebayasi Exp $ */
+/* $OpenBSD: dwc2_hcd.c,v 1.8 2015/02/10 23:10:21 uebayasi Exp $ */
/* $NetBSD: dwc2_hcd.c,v 1.15 2014/11/24 10:14:14 skrll Exp $ */
/*
@@ -2137,7 +2137,7 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg)
free(hsotg->core_params, M_DEVBUF, sizeof(*hsotg->core_params));
hsotg->core_params = NULL;
- timeout_destroy(&hsotg->wkp_timer);
+ timeout_del(&hsotg->wkp_timer);
}
static void dwc2_hcd_release(struct dwc2_hsotg *hsotg)
@@ -2174,7 +2174,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg,
{
struct dwc2_host_chan *channel;
int i, num_channels;
- int err, retval;
+ int retval;
dev_dbg(hsotg->dev, "DWC OTG HCD INIT\n");
@@ -2227,17 +2227,14 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg,
/* Create new workqueue and init work */
retval = -ENOMEM;
- err = taskq_create(&hsotg->wq_otg, "dwc2", dwc2_worker, hsotg,
- PRI_BIO, IPL_USB, WQ_MPSAFE);
+ hsotg->wq_otg = taskq_create("dwc2", 1, IPL_USB);
- retval = -err;
if (err) {
dev_err(hsotg->dev, "Failed to create workqueue\n");
goto error2;
}
- timeout_init(&hsotg->wkp_timer, CALLOUT_MPSAFE);
- timeout_setfunc(&hsotg->wkp_timer, dwc2_wakeup_detected, hsotg);
+ timeout_set(&hsotg->wkp_timer, dwc2_wakeup_detected, hsotg);
/* Initialize the non-periodic schedule */
INIT_LIST_HEAD(&hsotg->non_periodic_sched_inactive);
diff --git a/sys/dev/usb/dwc2/dwc2var.h b/sys/dev/usb/dwc2/dwc2var.h
index b54fee3eef4..90ae725fe9d 100644
--- a/sys/dev/usb/dwc2/dwc2var.h
+++ b/sys/dev/usb/dwc2/dwc2var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2var.h,v 1.6 2015/02/10 14:15:14 uebayasi Exp $ */
+/* $OpenBSD: dwc2var.h,v 1.7 2015/02/10 23:10:21 uebayasi Exp $ */
/* $NetBSD: dwc2var.h,v 1.3 2013/10/22 12:57:40 skrll Exp $ */
/*-
@@ -132,4 +132,10 @@ dwc2_root_intr(dwc2_softc_t *sc)
softintr_schedule(sc->sc_rhc_si);
}
+#define timeout_reset(x, t, f, a) \
+do { \
+ timeout_set((x), (f), (a)); \
+ timeout_add((x), (t)); \
+} while (0)
+
#endif /* _DWC_OTGVAR_H_ */