diff options
author | marcel <marcel@FreeBSD.org> | 2003-09-17 01:41:21 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-09-17 01:41:21 +0000 |
commit | 96dbeb7199a05e6fb1bc00cdfcd8727467423d09 (patch) | |
tree | 976d5fcb92d42c5763ac054fcd83a3a3ba593d98 /sys/dev/uart/uart_core.c | |
parent | 25d51778fc93c3659f92b88183b9b4f4814bc3f4 (diff) | |
download | FreeBSD-src-96dbeb7199a05e6fb1bc00cdfcd8727467423d09.zip FreeBSD-src-96dbeb7199a05e6fb1bc00cdfcd8727467423d09.tar.gz |
Add locking to the hardware drivers. I intended to figure out more
precisely where locking would be needed before adding it, but it
seems uart(4) draws slightly too much attention to have it without
locking for too long.
The lock added is a spinlock that protects access to the underlying
hardware. As a first and obvious stab at this, each method of the
hardware interface grabs the lock. Roughly speaking this serializes
the methods. Exceptions are the probe, attach and detach methods.
Diffstat (limited to 'sys/dev/uart/uart_core.c')
-rw-r--r-- | sys/dev/uart/uart_core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index 883bea2..dd4f91c 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -309,6 +309,8 @@ uart_bus_attach(device_t dev) */ sc->sc_leaving = 1; + mtx_init(&sc->sc_hwmtx, "uart_hwmtx", NULL, MTX_SPIN); + /* * Re-allocate. We expect that the softc contains the information * collected by uart_bus_probe() intact. |