diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-05-03 09:36:27 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-05-03 09:36:27 +0000 |
commit | 1b12866bae37a06fd7f26b4aa97eec3b73665a40 (patch) | |
tree | fea25192cd0344b893e3d1d1c5d381e0c850033e /sys/dev/pci/viapm.c | |
parent | cc4849d43c0e1a7507cc242cf1c912de683125fb (diff) |
convert lockmgr style locks to rwlocks.
input from art@
Diffstat (limited to 'sys/dev/pci/viapm.c')
-rw-r--r-- | sys/dev/pci/viapm.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/pci/viapm.c b/sys/dev/pci/viapm.c index 86017084357..a9360e5378b 100644 --- a/sys/dev/pci/viapm.c +++ b/sys/dev/pci/viapm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viapm.c,v 1.7 2007/04/29 05:40:20 jsg Exp $ */ +/* $OpenBSD: viapm.c,v 1.8 2007/05/03 09:36:26 dlg Exp $ */ /* * Copyright (c) 2005 Mark Kettenis <kettenis@openbsd.org> @@ -24,7 +24,7 @@ #include <sys/systm.h> #include <sys/device.h> #include <sys/kernel.h> -#include <sys/lock.h> +#include <sys/rwlock.h> #include <sys/proc.h> #include <machine/bus.h> @@ -94,7 +94,7 @@ struct viapm_softc { int sc_poll; struct i2c_controller sc_i2c_tag; - struct lock sc_i2c_lock; + struct rwlock sc_i2c_lock; struct { i2c_op_t op; void * buf; @@ -203,7 +203,7 @@ viapm_attach(struct device *parent, struct device *self, void *aux) printf("\n"); /* Attach I2C bus */ - lockinit(&sc->sc_i2c_lock, PRIBIO | PCATCH, "iiclk", 0, 0); + rw_init(&sc->sc_i2c_lock, "iiclk"); sc->sc_i2c_tag.ic_cookie = sc; sc->sc_i2c_tag.ic_acquire_bus = viapm_i2c_acquire_bus; sc->sc_i2c_tag.ic_release_bus = viapm_i2c_release_bus; @@ -228,7 +228,7 @@ viapm_i2c_acquire_bus(void *cookie, int flags) if (cold || sc->sc_poll || (flags & I2C_F_POLL)) return (0); - return (lockmgr(&sc->sc_i2c_lock, LK_EXCLUSIVE, NULL)); + return (rw_enter(&sc->sc_i2c_lock, RW_WRITE | RW_INTR)); } void @@ -239,7 +239,7 @@ viapm_i2c_release_bus(void *cookie, int flags) if (cold || sc->sc_poll || (flags & I2C_F_POLL)) return; - lockmgr(&sc->sc_i2c_lock, LK_RELEASE, NULL); + rw_exit(&sc->sc_i2c_lock); } int |