summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-05-21 03:11:12 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-05-21 03:11:12 +0000
commit9bf01a730222fe0b5b9edb6961eddc3758cf3164 (patch)
treeaf64c1bc34205f63b07447b1a340bdf55d522782 /sys/dev/ic
parent025fd76dd94075c770247c7c463859b14eaf0a87 (diff)
Switch pcfiic to rwlock.
ok dlg@ kettenis@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/pcf8584.c10
-rw-r--r--sys/dev/ic/pcf8584var.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/ic/pcf8584.c b/sys/dev/ic/pcf8584.c
index 8a425df832e..a428effeaec 100644
--- a/sys/dev/ic/pcf8584.c
+++ b/sys/dev/ic/pcf8584.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcf8584.c,v 1.7 2006/06/22 08:33:43 deraadt Exp $ */
+/* $OpenBSD: pcf8584.c,v 1.8 2007/05/21 03:11:11 jsg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -21,7 +21,7 @@
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
+#include <sys/rwlock.h>
#include <sys/proc.h>
#include <machine/bus.h>
@@ -128,7 +128,7 @@ pcfiic_attach(struct pcfiic_softc *sc, i2c_addr_t addr, u_int8_t clock,
if (sc->sc_master)
pcfiic_choose_bus(sc, 0);
- lockinit(&sc->sc_lock, PRIBIO | PCATCH, "iiclk", 0, 0);
+ rw_init(&sc->sc_lock, "iiclk");
sc->sc_i2c.ic_cookie = sc;
sc->sc_i2c.ic_acquire_bus = pcfiic_i2c_acquire_bus;
sc->sc_i2c.ic_release_bus = pcfiic_i2c_release_bus;
@@ -156,7 +156,7 @@ pcfiic_i2c_acquire_bus(void *arg, int flags)
if (cold || sc->sc_poll || (flags & I2C_F_POLL))
return (0);
- return (lockmgr(&sc->sc_lock, LK_EXCLUSIVE, NULL));
+ return (rw_enter(&sc->sc_lock, RW_WRITE | RW_INTR));
}
void
@@ -167,7 +167,7 @@ pcfiic_i2c_release_bus(void *arg, int flags)
if (cold || sc->sc_poll || (flags & I2C_F_POLL))
return;
- lockmgr(&sc->sc_lock, LK_RELEASE, NULL);
+ rw_exit(&sc->sc_lock);
}
int
diff --git a/sys/dev/ic/pcf8584var.h b/sys/dev/ic/pcf8584var.h
index cd8947f4b91..95cbbb552d0 100644
--- a/sys/dev/ic/pcf8584var.h
+++ b/sys/dev/ic/pcf8584var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcf8584var.h,v 1.3 2006/06/22 08:33:43 deraadt Exp $ */
+/* $OpenBSD: pcf8584var.h,v 1.4 2007/05/21 03:11:11 jsg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -30,7 +30,7 @@ struct pcfiic_softc {
int sc_poll;
struct i2c_controller sc_i2c;
- struct lock sc_lock;
+ struct rwlock sc_lock;
};
/* clock divisor settings */