svn commit: r215346 - user/weongyo/usb/sys/dev/usb
Weongyo Jeong
weongyo at FreeBSD.org
Mon Nov 15 21:19:50 UTC 2010
Author: weongyo
Date: Mon Nov 15 21:19:50 2010
New Revision: 215346
URL: http://svn.freebsd.org/changeset/base/215346
Log:
Stopping / draining the callout should happen first to make sure that
the task wouldn't be enqueued during stopping the taskqueue.
Pointed by: hps
Modified:
user/weongyo/usb/sys/dev/usb/usb_sleepout.c
Modified: user/weongyo/usb/sys/dev/usb/usb_sleepout.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/usb_sleepout.c Mon Nov 15 19:55:19 2010 (r215345)
+++ user/weongyo/usb/sys/dev/usb/usb_sleepout.c Mon Nov 15 21:19:50 2010 (r215346)
@@ -109,20 +109,31 @@ int
sleepout_stop(struct sleepout_task *st)
{
struct sleepout *s = st->st_sleepout;
+ int ret;
+
+ ret = callout_stop(&st->st_callout);
/*
* XXX the return value is ignored but one thing clear is that the task
* isn't on the task queue list after this moment.
*/
(void)taskqueue_cancel(s->s_taskqueue, &st->st_task, NULL);
- return (callout_stop(&st->st_callout));
+
+ return (ret);
}
int
sleepout_drain(struct sleepout_task *st)
{
struct sleepout *s = st->st_sleepout;
+ int ret;
+ /*
+ * Always the sequence to stop / drain a sleepout is that callout(9)
+ * should be handled first to make sure that it's not enqueued at
+ * the task list.
+ */
+ ret = callout_drain(&st->st_callout);
taskqueue_drain(s->s_taskqueue, &st->st_task);
- return (callout_drain(&st->st_callout));
+ return (ret);
}
More information about the svn-src-user
mailing list