summaryrefslogtreecommitdiff
path: root/sys/dev/pci/amdiic.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-05-03 09:36:27 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-05-03 09:36:27 +0000
commit1b12866bae37a06fd7f26b4aa97eec3b73665a40 (patch)
treefea25192cd0344b893e3d1d1c5d381e0c850033e /sys/dev/pci/amdiic.c
parentcc4849d43c0e1a7507cc242cf1c912de683125fb (diff)
convert lockmgr style locks to rwlocks.
input from art@
Diffstat (limited to 'sys/dev/pci/amdiic.c')
-rw-r--r--sys/dev/pci/amdiic.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/pci/amdiic.c b/sys/dev/pci/amdiic.c
index 693a425b268..2b734e91f8e 100644
--- a/sys/dev/pci/amdiic.c
+++ b/sys/dev/pci/amdiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amdiic.c,v 1.5 2006/09/28 18:19:14 grange Exp $ */
+/* $OpenBSD: amdiic.c,v 1.6 2007/05/03 09:36:26 dlg Exp $ */
/*
* Copyright (c) 2005 Alexander Yurchenko <grange@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>
@@ -87,7 +87,7 @@ struct amdiic_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;
@@ -176,7 +176,7 @@ amdiic_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 = amdiic_i2c_acquire_bus;
sc->sc_i2c_tag.ic_release_bus = amdiic_i2c_release_bus;
@@ -252,7 +252,7 @@ amdiic_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
@@ -263,7 +263,7 @@ amdiic_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