diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-05-20 00:52:27 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-05-20 00:52:27 +0000 |
commit | 2dbfbaea83b6cf3e9c5258c73e71f7f3d516701f (patch) | |
tree | ed41735ac73773a7c10db55f6b7d0e5d38a251a4 /sys/dev | |
parent | e368a7bf45c060b9b6d89d23467edd46afc11ad6 (diff) |
Convert ehci and ucom to rwlock.
Kill the usb specific lockmgr wrapper as nothing uses it now.
ok thib@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/cardbus/ehci_cardbus.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/ehci_pci.c | 3 | ||||
-rw-r--r-- | sys/dev/usb/ehci.c | 9 | ||||
-rw-r--r-- | sys/dev/usb/ehcivar.h | 4 | ||||
-rw-r--r-- | sys/dev/usb/ucom.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/usb_port.h | 4 |
6 files changed, 19 insertions, 16 deletions
diff --git a/sys/dev/cardbus/ehci_cardbus.c b/sys/dev/cardbus/ehci_cardbus.c index c822a29397c..52933e46f57 100644 --- a/sys/dev/cardbus/ehci_cardbus.c +++ b/sys/dev/cardbus/ehci_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci_cardbus.c,v 1.8 2006/10/12 16:35:52 grange Exp $ */ +/* $OpenBSD: ehci_cardbus.c,v 1.9 2007/05/20 00:52:26 jsg Exp $ */ /* $NetBSD: ehci_cardbus.c,v 1.6.6.3 2004/09/21 13:27:25 skrll Exp $ */ /* @@ -41,6 +41,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/rwlock.h> #include <sys/device.h> #include <sys/proc.h> diff --git a/sys/dev/pci/ehci_pci.c b/sys/dev/pci/ehci_pci.c index 59665d44113..c2bc3b83615 100644 --- a/sys/dev/pci/ehci_pci.c +++ b/sys/dev/pci/ehci_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci_pci.c,v 1.10 2006/08/25 04:17:00 pascoe Exp $ */ +/* $OpenBSD: ehci_pci.c,v 1.11 2007/05/20 00:52:26 jsg Exp $ */ /* $NetBSD: ehci_pci.c,v 1.15 2004/04/23 21:13:06 itojun Exp $ */ /* @@ -40,6 +40,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/rwlock.h> #include <sys/device.h> #include <sys/proc.h> #include <sys/queue.h> diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 8f63d6d9a7a..8feb626a385 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci.c,v 1.67 2006/08/22 01:53:42 pascoe Exp $ */ +/* $OpenBSD: ehci.c,v 1.68 2007/05/20 00:52:25 jsg Exp $ */ /* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */ /* @@ -62,6 +62,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/rwlock.h> #include <sys/malloc.h> #include <sys/device.h> #include <sys/selinfo.h> @@ -475,7 +476,7 @@ ehci_init(ehci_softc_t *sc) usb_callout_init(sc->sc_tmo_pcd); usb_callout_init(sc->sc_tmo_intrlist); - lockinit(&sc->sc_doorbell_lock, PZERO, "ehcidb", 0, 0); + rw_init(&sc->sc_doorbell_lock, "ehcidb"); /* Turn on controller */ EOWRITE4(sc, EHCI_USBCMD, @@ -1520,7 +1521,7 @@ ehci_sync_hc(ehci_softc_t *sc) } DPRINTFN(2,("ehci_sync_hc: enter\n")); /* get doorbell */ - usb_lockmgr(&sc->sc_doorbell_lock, LK_EXCLUSIVE, NULL, curproc); + rw_enter_write(&sc->sc_doorbell_lock); s = splhardusb(); do { /* ask for doorbell */ @@ -1535,7 +1536,7 @@ ehci_sync_hc(ehci_softc_t *sc) } while (error && ++tries < 10); splx(s); /* release doorbell */ - usb_lockmgr(&sc->sc_doorbell_lock, LK_RELEASE, NULL, curproc); + rw_exit_write(&sc->sc_doorbell_lock); #ifdef DIAGNOSTIC if (error) printf("ehci_sync_hc: tsleep() = %d\n", error); diff --git a/sys/dev/usb/ehcivar.h b/sys/dev/usb/ehcivar.h index cdc8df4fff6..df68eaa40a9 100644 --- a/sys/dev/usb/ehcivar.h +++ b/sys/dev/usb/ehcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ehcivar.h,v 1.10 2006/08/14 00:41:11 pascoe Exp $ */ +/* $OpenBSD: ehcivar.h,v 1.11 2007/05/20 00:52:26 jsg Exp $ */ /* $NetBSD: ehcivar.h,v 1.19 2005/04/29 15:04:29 augustss Exp $ */ /* @@ -131,7 +131,7 @@ typedef struct ehci_softc { SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */ - struct lock sc_doorbell_lock; + struct rwlock sc_doorbell_lock; usb_callout_t sc_tmo_pcd; usb_callout_t sc_tmo_intrlist; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 85c5a454856..6fee0fe07de 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.32 2006/08/29 08:15:10 mbalmer Exp $ */ +/* $OpenBSD: ucom.c,v 1.33 2007/05/20 00:52:26 jsg Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -44,6 +44,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/rwlock.h> #include <sys/ioctl.h> #include <sys/conf.h> #include <sys/tty.h> @@ -123,7 +124,7 @@ struct ucom_softc { u_char sc_cua; - struct lock sc_lock; /* lock during open */ + struct rwlock sc_lock; /* lock during open */ int sc_open; int sc_refcnt; u_char sc_dying; /* disconnecting */ @@ -153,13 +154,13 @@ Static void ucom_lock(struct ucom_softc *sc) { sc->sc_refcnt++; - usb_lockmgr(&sc->sc_lock, LK_EXCLUSIVE, NULL, curproc); + rw_enter_write(&sc->sc_lock); } Static void ucom_unlock(struct ucom_softc *sc) { - usb_lockmgr(&sc->sc_lock, LK_RELEASE, NULL, curproc); + rw_exit_write(&sc->sc_lock); if (--sc->sc_refcnt < 0) usb_detach_wakeup(USBDEV(sc->sc_dev)); } @@ -198,7 +199,8 @@ USB_ATTACH(ucom) sc->sc_tty = tp; sc->sc_cua = 0; - lockinit(&sc->sc_lock, PZERO, "ucomlk", 0, LK_CANRECURSE); + rw_init(&sc->sc_lock, "ucomlk"); + sc->sc_open = 0; USB_ATTACH_SUCCESS_RETURN; diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 13e4dec00fe..cc4f06aa508 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_port.h,v 1.62 2006/09/18 10:55:51 dlg Exp $ */ +/* $OpenBSD: usb_port.h,v 1.63 2007/05/20 00:52:26 jsg Exp $ */ /* $NetBSD: usb_port.h,v 1.62 2003/02/15 18:33:30 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -162,8 +162,6 @@ typedef struct timeout usb_callout_t; #define usb_callout_pending(h) timeout_pending(&(h)) #define usb_uncallout(h, f, d) timeout_del(&(h)) -#define usb_lockmgr(l, f, sl, p) lockmgr((l), (f), (sl)) - #define USB_DECLARE_DRIVER_CLASS(dname, devclass) \ int __CONCAT(dname,_match)(struct device *, void *, void *); \ void __CONCAT(dname,_attach)(struct device *, struct device *, void *); \ |