summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-04-24 08:32:16 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-04-24 08:32:16 +0000
commit2bc75459a16892fdb937b62d55d08f40895f75c2 (patch)
tree4c083adc53e25d7b66c86984976a0b387518b369 /sys/dev
parentd269632bbad553bb70cc3933dce921d33d6479af (diff)
This code is only called during autoconf, and never ever from an
interrupt handler.  So the locking and spl manipulation can simply go away. ok deraadt@, oga@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/cy82c693.c47
1 files changed, 3 insertions, 44 deletions
diff --git a/sys/dev/pci/cy82c693.c b/sys/dev/pci/cy82c693.c
index 36bbcc4edf6..722d3099873 100644
--- a/sys/dev/pci/cy82c693.c
+++ b/sys/dev/pci/cy82c693.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cy82c693.c,v 1.6 2008/06/26 05:42:17 ray Exp $ */
+/* $OpenBSD: cy82c693.c,v 1.7 2010/04/24 08:32:15 kettenis Exp $ */
/* $NetBSD: cy82c693.c,v 1.1 2000/06/06 03:07:39 thorpej Exp $ */
/*-
@@ -35,12 +35,9 @@
* hyperCache(tm) Stand-Alone PCI Peripheral Controller with USB.
*/
-#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
#include <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h>
-#include <sys/lock.h>
#include <machine/bus.h>
@@ -53,40 +50,19 @@
static struct cy82c693_handle cyhc_handle;
static int cyhc_initialized;
-struct simplelock cyhc_slock;
-
-#define CYHC_LOCK(s) \
-do { \
- s = splhigh(); \
- simple_lock(&cyhc_slock); \
-} while (0)
-
-#define CYHC_UNLOCK(s) \
-do { \
- simple_unlock(&cyhc_slock); \
- splx(s); \
-} while (0)
-
const struct cy82c693_handle *
cy82c693_init(bus_space_tag_t iot)
{
bus_space_handle_t ioh;
- int s;
int error;
- simple_lock_init(&cyhc_slock);
-
- CYHC_LOCK(s);
-
if (cyhc_initialized) {
- CYHC_UNLOCK(s);
if (iot != cyhc_handle.cyhc_iot)
panic("cy82c693_init");
return (&cyhc_handle);
}
if ((error = bus_space_map(iot, CYHC_CONFIG_ADDR, 2, 0, &ioh)) != 0) {
- CYHC_UNLOCK(s);
printf("cy82c693_init: bus_space_map failed (%d)", error);
return (NULL);
}
@@ -96,46 +72,29 @@ cy82c693_init(bus_space_tag_t iot)
cyhc_initialized = 1;
- CYHC_UNLOCK(s);
-
return (&cyhc_handle);
}
u_int8_t
cy82c693_read(const struct cy82c693_handle *cyhc, int reg)
{
- int s;
u_int8_t rv;
- CYHC_LOCK(s);
-
- if (cyhc_initialized == 0) {
- CYHC_UNLOCK(s);
+ if (cyhc_initialized == 0)
panic("cy82c693_read");
- }
bus_space_write_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 0, reg);
rv = bus_space_read_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 1);
- CYHC_UNLOCK(s);
-
return (rv);
}
void
cy82c693_write(const struct cy82c693_handle *cyhc, int reg, u_int8_t val)
{
- int s;
-
- CYHC_LOCK(s);
-
- if (cyhc_initialized == 0) {
- CYHC_UNLOCK(s);
+ if (cyhc_initialized == 0)
panic("cy82c693_write");
- }
bus_space_write_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 0, reg);
bus_space_write_1(cyhc->cyhc_iot, cyhc->cyhc_ioh, 1, val);
-
- CYHC_UNLOCK(s);
}