summaryrefslogtreecommitdiff
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
parentcc4849d43c0e1a7507cc242cf1c912de683125fb (diff)
convert lockmgr style locks to rwlocks.
input from art@
-rw-r--r--sys/dev/pci/alipm.c10
-rw-r--r--sys/dev/pci/amdiic.c12
-rw-r--r--sys/dev/pci/amdpm.c12
-rw-r--r--sys/dev/pci/ichiic.c12
-rw-r--r--sys/dev/pci/nviic.c8
-rw-r--r--sys/dev/pci/piixpm.c12
-rw-r--r--sys/dev/pci/viapm.c12
7 files changed, 38 insertions, 40 deletions
diff --git a/sys/dev/pci/alipm.c b/sys/dev/pci/alipm.c
index c22b82b1f22..bc72af46e33 100644
--- a/sys/dev/pci/alipm.c
+++ b/sys/dev/pci/alipm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alipm.c,v 1.11 2006/12/11 18:16:37 deraadt Exp $ */
+/* $OpenBSD: alipm.c,v 1.12 2007/05/03 09:36:26 dlg Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -19,7 +19,7 @@
#include <sys/param.h>
#include <sys/device.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
+#include <sys/rwlock.h>
#include <sys/proc.h>
#include <sys/systm.h>
@@ -211,7 +211,7 @@ alipm_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
/* Attach I2C bus */
- lockinit(&sc->sc_smb_lock, PRIBIO | PCATCH, "alipm", 0, 0);
+ rw_init(&sc->sc_smb_lock, "alipm");
sc->sc_smb_tag.ic_cookie = sc;
sc->sc_smb_tag.ic_acquire_bus = alipm_smb_acquire_bus;
sc->sc_smb_tag.ic_release_bus = alipm_smb_release_bus;
@@ -240,7 +240,7 @@ alipm_smb_acquire_bus(void *cookie, int flags)
if (flags & I2C_F_POLL)
return (0);
- return (lockmgr(&sc->sc_smb_lock, LK_EXCLUSIVE, NULL));
+ return (rw_enter(&sc->sc_smb_lock, RW_WRITE | RW_INTR));
}
void
@@ -251,7 +251,7 @@ alipm_smb_release_bus(void *cookie, int flags)
if (flags & I2C_F_POLL)
return;
- lockmgr(&sc->sc_smb_lock, LK_RELEASE, NULL);
+ rw_exit(&sc->sc_smb_lock);
}
int
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
diff --git a/sys/dev/pci/amdpm.c b/sys/dev/pci/amdpm.c
index 8af6cb8aca4..a28abbbd574 100644
--- a/sys/dev/pci/amdpm.c
+++ b/sys/dev/pci/amdpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amdpm.c,v 1.20 2006/12/11 18:16:37 deraadt Exp $ */
+/* $OpenBSD: amdpm.c,v 1.21 2007/05/03 09:36:26 dlg Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -56,7 +56,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 <sys/timeout.h>
#ifdef __HAVE_TIMECOUNTER
@@ -174,7 +174,7 @@ struct amdpm_softc {
struct timeout sc_rnd_ch;
struct i2c_controller sc_i2c_tag;
- struct lock sc_i2c_lock;
+ struct rwlock sc_i2c_lock;
struct {
i2c_op_t op;
void *buf;
@@ -307,7 +307,7 @@ amdpm_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 = amdpm_i2c_acquire_bus;
sc->sc_i2c_tag.ic_release_bus = amdpm_i2c_release_bus;
@@ -364,7 +364,7 @@ amdpm_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
@@ -375,7 +375,7 @@ amdpm_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
diff --git a/sys/dev/pci/ichiic.c b/sys/dev/pci/ichiic.c
index 3093d24a729..e823bc65a72 100644
--- a/sys/dev/pci/ichiic.c
+++ b/sys/dev/pci/ichiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ichiic.c,v 1.17 2006/09/28 18:19:14 grange Exp $ */
+/* $OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $ */
/*
* Copyright (c) 2005, 2006 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>
@@ -55,7 +55,7 @@ struct ichiic_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;
@@ -156,7 +156,7 @@ ichiic_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 = ichiic_i2c_acquire_bus;
sc->sc_i2c_tag.ic_release_bus = ichiic_i2c_release_bus;
@@ -178,7 +178,7 @@ ichiic_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
@@ -189,7 +189,7 @@ ichiic_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
diff --git a/sys/dev/pci/nviic.c b/sys/dev/pci/nviic.c
index 16dbc797358..57dc7ecd2e2 100644
--- a/sys/dev/pci/nviic.c
+++ b/sys/dev/pci/nviic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nviic.c,v 1.10 2007/05/03 01:38:15 dlg Exp $ */
+/* $OpenBSD: nviic.c,v 1.11 2007/05/03 09:36:26 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -197,9 +197,7 @@ nviic_i2c_acquire_bus(void *arg, int flags)
if (cold || (flags & I2C_F_POLL))
return (0);
- rw_enter_write(&nc->nc_lock);
-
- return (0);
+ return (rw_enter(&nc->nc_lock, RW_WRITE | RW_INTR));
}
void
@@ -210,7 +208,7 @@ nviic_i2c_release_bus(void *arg, int flags)
if (cold || (flags & I2C_F_POLL))
return;
- rw_exit_write(&nc->nc_lock);
+ rw_exit(&nc->nc_lock);
}
int
diff --git a/sys/dev/pci/piixpm.c b/sys/dev/pci/piixpm.c
index 89e904e9a8b..8339aa5e1a8 100644
--- a/sys/dev/pci/piixpm.c
+++ b/sys/dev/pci/piixpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: piixpm.c,v 1.26 2007/04/29 05:51:51 jsg Exp $ */
+/* $OpenBSD: piixpm.c,v 1.27 2007/05/03 09:36:26 dlg Exp $ */
/*
* Copyright (c) 2005, 2006 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>
@@ -55,7 +55,7 @@ struct piixpm_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;
@@ -160,7 +160,7 @@ piixpm_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 = piixpm_i2c_acquire_bus;
sc->sc_i2c_tag.ic_release_bus = piixpm_i2c_release_bus;
@@ -182,7 +182,7 @@ piixpm_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
@@ -193,7 +193,7 @@ piixpm_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
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