svn commit: r196274 - head/sys/dev/usb

Andrew Thompson thompsa at FreeBSD.org
Sun Aug 16 14:13:56 UTC 2009


Author: thompsa
Date: Sun Aug 16 14:13:55 2009
New Revision: 196274
URL: http://svn.freebsd.org/changeset/base/196274

Log:
  Change the usb workers from kernel processes to threads, this is mostly a
  cosmetic change to reduce cruft in the proc table.
  
  Also change the idle wait message to `-` like how taskqueues are.
  
  Reviewed by:	julian
  Approved by:	re (kib)

Modified:
  head/sys/dev/usb/usb_process.c
  head/sys/dev/usb/usb_process.h

Modified: head/sys/dev/usb/usb_process.c
==============================================================================
--- head/sys/dev/usb/usb_process.c	Sun Aug 16 10:25:58 2009	(r196273)
+++ head/sys/dev/usb/usb_process.c	Sun Aug 16 14:13:55 2009	(r196274)
@@ -63,10 +63,12 @@
 #endif
 
 #if (__FreeBSD_version >= 800000)
+static struct proc *usbproc;
 #define	USB_THREAD_CREATE(f, s, p, ...) \
-		kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
-#define	USB_THREAD_SUSPEND(p)   kproc_suspend(p,0)
-#define	USB_THREAD_EXIT(err)	kproc_exit(err)
+		kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \
+		    0, "usb", __VA_ARGS__)
+#define	USB_THREAD_SUSPEND(p)   kthread_suspend(p,0)
+#define	USB_THREAD_EXIT(err)	kthread_exit()
 #else
 #define	USB_THREAD_CREATE(f, s, p, ...) \
 		kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
@@ -207,8 +209,8 @@ usb_proc_create(struct usb_process *up, 
 
 	TAILQ_INIT(&up->up_qhead);
 
-	cv_init(&up->up_cv, "wmsg");
-	cv_init(&up->up_drain, "dmsg");
+	cv_init(&up->up_cv, "-");
+	cv_init(&up->up_drain, "usbdrain");
 
 	if (USB_THREAD_CREATE(&usb_process, up,
 	    &up->up_ptr, pmesg)) {

Modified: head/sys/dev/usb/usb_process.h
==============================================================================
--- head/sys/dev/usb/usb_process.h	Sun Aug 16 10:25:58 2009	(r196273)
+++ head/sys/dev/usb/usb_process.h	Sun Aug 16 14:13:55 2009	(r196274)
@@ -49,7 +49,11 @@ struct usb_process {
 	struct cv up_cv;
 	struct cv up_drain;
 
+#if (__FreeBSD_version >= 800000)
+	struct thread *up_ptr;
+#else
 	struct proc *up_ptr;
+#endif
 	struct thread *up_curtd;
 	struct mtx *up_mtx;
 


More information about the svn-src-all mailing list