diff options
| author | ad <ad@NetBSD.org> | 2007-07-09 20:51:58 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-07-09 20:51:58 +0000 |
| commit | 88ab7da936c561aba9ff7492617ffb08f8d08ece (patch) | |
| tree | d9d78b17ff651178241606f2e7766abdd0f15137 /sys/dev/usb | |
| parent | 317bac119f13240650ea6882854b381cf1024fa1 (diff) | |
Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
Diffstat (limited to 'sys/dev/usb')
| -rw-r--r-- | sys/dev/usb/usb.c | 16 | ||||
| -rw-r--r-- | sys/dev/usb/usb_port.h | 9 | ||||
| -rw-r--r-- | sys/dev/usb/usbdivar.h | 9 | ||||
| -rw-r--r-- | sys/dev/usb/ustir.c | 17 |
4 files changed, 24 insertions, 27 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 2888d981222..bea2b2a23e1 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.96 2007/03/04 06:02:50 christos Exp $ */ +/* $NetBSD: usb.c,v 1.97 2007/07/09 21:01:24 ad Exp $ */ /* * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.96 2007/03/04 06:02:50 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.97 2007/07/09 21:01:24 ad Exp $"); #include "opt_compat_netbsd.h" @@ -102,14 +102,14 @@ struct usb_softc { usbd_bus_handle sc_bus; /* USB controller */ struct usbd_port sc_port; /* dummy port for root hub */ - struct proc *sc_event_thread; + struct lwp *sc_event_thread; char sc_dying; }; struct usb_taskq { TAILQ_HEAD(, usb_task) tasks; - struct proc *task_thread_proc; + struct lwp *task_thread_lwp; const char *name; int taskcreated; /* task thread exists. */ }; @@ -263,8 +263,8 @@ usb_create_event_thread(void *arg) struct usb_taskq *taskq; int i; - if (usb_kthread_create1(usb_event_thread, sc, &sc->sc_event_thread, - "%s", sc->sc_dev.dv_xname)) { + if (usb_kthread_create1(PRI_NONE, 0, NULL, usb_event_thread, sc, + &sc->sc_event_thread, "%s", sc->sc_dev.dv_xname)) { printf("%s: unable to create event thread for\n", sc->sc_dev.dv_xname); panic("usb_create_event_thread"); @@ -278,8 +278,8 @@ usb_create_event_thread(void *arg) TAILQ_INIT(&taskq->tasks); taskq->taskcreated = 1; taskq->name = taskq_names[i]; - if (usb_kthread_create1(usb_task_thread, taskq, - &taskq->task_thread_proc, taskq->name)) { + if (usb_kthread_create1(PRI_NONE, 0, NULL, usb_task_thread, + taskq, &taskq->task_thread_lwp, taskq->name)) { printf("unable to create task thread: %s\n", taskq->name); panic("usb_create_event_thread task"); } diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 9e130913efa..4700bd2a93a 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,5 +1,5 @@ /* $OpenBSD: usb_port.h,v 1.18 2000/09/06 22:42:10 rahnds Exp $ */ -/* $NetBSD: usb_port.h,v 1.75 2007/03/13 13:51:56 drochner Exp $ */ +/* $NetBSD: usb_port.h,v 1.76 2007/07/09 21:01:25 ad Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -122,14 +122,15 @@ typedef struct device *device_ptr_t; } usb_dma_t typedef struct callout usb_callout_t; -#define usb_callout_init(h) callout_init(&(h)) +#define usb_callout_init(h) callout_init(&(h), 0) +#define usb_callout_destroy(h) callout_destroy((&h)) #define usb_callout(h, t, f, d) callout_reset(&(h), (t), (f), (d)) #define usb_uncallout(h, f, d) callout_stop(&(h)) #define usb_lockmgr lockmgr -#define usb_kthread_create1 kthread_create1 -#define usb_kthread_create kthread_create +#define usb_kthread_create1 kthread_create +#define usb_kthread_create(f, a) ((f)(a)) typedef struct malloc_type *usb_malloc_type; diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h index b3493b91109..d1871f57126 100644 --- a/sys/dev/usb/usbdivar.h +++ b/sys/dev/usb/usbdivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdivar.h,v 1.80 2007/02/26 13:23:59 drochner Exp $ */ +/* $NetBSD: usbdivar.h,v 1.81 2007/07/09 21:01:25 ad Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */ /* @@ -126,14 +126,7 @@ struct usbd_bus { #define USBREV_2_0 4 #define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1", "2.0" } -#ifdef USB_USE_SOFTINTR -#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS void *soft; /* soft interrupt cookie */ -#else - struct callout softi; -#endif -#endif - #if defined(__NetBSD__) || defined(__OpenBSD__) bus_dma_tag_t dmatag; /* DMA tag */ #endif diff --git a/sys/dev/usb/ustir.c b/sys/dev/usb/ustir.c index 954cc46ca17..9e4cd70a8da 100644 --- a/sys/dev/usb/ustir.c +++ b/sys/dev/usb/ustir.c @@ -1,4 +1,4 @@ -/* $NetBSD: ustir.c,v 1.19 2007/03/13 13:51:57 drochner Exp $ */ +/* $NetBSD: ustir.c,v 1.20 2007/07/09 21:01:25 ad Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ustir.c,v 1.19 2007/03/13 13:51:57 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ustir.c,v 1.20 2007/07/09 21:01:25 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -176,7 +176,7 @@ struct ustir_softc { u_int sc_rd_expectdataticks; u_char sc_rd_err; struct framestate sc_framestate; - struct proc *sc_thread; + struct lwp *sc_thread; struct selinfo sc_rd_sel; u_int8_t *sc_wr_buf; @@ -923,13 +923,16 @@ ustir_open(void *h, int flag, int mode, deframe_init(&sc->sc_framestate, &framedef_sir, sc->sc_ur_buf, IRDA_MAX_FRAME_SIZE); - error = kthread_create1(ustir_thread, sc, &sc->sc_thread, "%s", - sc->sc_dev.dv_xname); - if (error) - goto bad5; /* Increment reference for thread */ sc->sc_refcnt++; + error = kthread_create(PRI_NONE, 0, NULL, ustir_thread, sc, + &sc->sc_thread, "%s", sc->sc_dev.dv_xname); + if (error) { + sc->sc_refcnt--; + goto bad5; + } + return 0; bad5: |
