summaryrefslogtreecommitdiff
path: root/sys/dev/ic/com.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-27 06:14:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-27 06:14:53 +0000
commit85dbe7ca610ea8b756d4a3368612571b4867502a (patch)
treeea6978722b991ba194e4bdbae8c4efb59f390ac9 /sys/dev/ic/com.c
parent49f8748d61e452bb0962f8dbd1955014431e975c (diff)
in detach, mark device with COM_SW_DEAD, so that close() will not go
tapping additional registes. allows it to work on macppc, where doing such a tap after unplug is very bad. drahn helped fkr@bytemine.de ok miod and drahn
Diffstat (limited to 'sys/dev/ic/com.c')
-rw-r--r--sys/dev/ic/com.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 2314b4205ac..cd245649229 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.109 2006/01/01 11:59:40 miod Exp $ */
+/* $OpenBSD: com.c,v 1.110 2006/03/27 06:14:52 deraadt Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*
@@ -207,6 +207,8 @@ com_detach(self, flags)
struct com_softc *sc = (struct com_softc *)self;
int maj, mn;
+ sc->sc_swflags |= COM_SW_DEAD;
+
/* locate the major number */
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == comopen)
@@ -501,6 +503,9 @@ comclose(dev, flag, mode, p)
return 0;
#endif
+ if(sc->sc_swflags & COM_SW_DEAD)
+ return 0;
+
(*linesw[tp->t_line].l_close)(tp, flag);
s = spltty();
if (ISSET(tp->t_state, TS_WOPEN)) {