Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb since usb task add/remove is supposed to be call...



details:   https://anonhg.NetBSD.org/src/rev/1da45f23117b
branches:  trunk
changeset: 782933:1da45f23117b
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Nov 27 04:54:58 2012 +0000

description:
since usb task add/remove is supposed to be callable in any usb
context, make sure the lock is OK for such.  ie, not a sleeping lock.
fixes PR#47244.

diffstat:

 sys/dev/usb/usb.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 3ced5e9281d8 -r 1da45f23117b sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Mon Nov 26 23:02:53 2012 +0000
+++ b/sys/dev/usb/usb.c Tue Nov 27 04:54:58 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.c,v 1.135 2012/07/20 23:18:02 mrg Exp $    */
+/*     $NetBSD: usb.c,v 1.136 2012/11/27 04:54:58 mrg Exp $    */
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.135 2012/07/20 23:18:02 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.136 2012/11/27 04:54:58 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -224,7 +224,11 @@
                taskq = &usb_taskq[i];
 
                TAILQ_INIT(&taskq->tasks);
-               mutex_init(&taskq->lock, MUTEX_DEFAULT, IPL_NONE);
+               /*
+                * Since USB tasks are callable from any context, we have to
+                * make this lock a spinlock.
+                */
+               mutex_init(&taskq->lock, MUTEX_DEFAULT, IPL_USB);
                cv_init(&taskq->cv, "usbtsk");
                taskq->name = taskq_names[i];
                if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,



Home | Main Index | Thread Index | Old Index