diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-03 16:44:52 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-03 16:44:52 +0000 |
commit | 24c386b577f126bce761c7288e987ae93c36aa88 (patch) | |
tree | 99166e0d499a2be11543cc5dd9774c63a12466eb /sys/dev | |
parent | e43c66ff4e929d0beb6716fb882523dc136b8c0c (diff) |
Merge tty_attach() in ttymalloc() and tty_detach() in ttyfree(). The need for
separate tty registering is gone now that sparc has switched to wscons, and
this makes the code less error-prone.
Also, remove tests for ttymalloc() failure, since it uses M_WAITOK.
ok millert@ deraadt@, tested by various people as well besides me...
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/com.c | 4 | ||||
-rw-r--r-- | sys/dev/ic/cy.c | 11 | ||||
-rw-r--r-- | sys/dev/ic/z8530tty.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/cz.c | 3 | ||||
-rw-r--r-- | sys/dev/sbus/magma.c | 5 | ||||
-rw-r--r-- | sys/dev/sbus/spif.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/ucom.c | 6 | ||||
-rw-r--r-- | sys/dev/wscons/wsdisplay.c | 4 |
8 files changed, 13 insertions, 28 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 1d76f57cdfa..c6b39f06882 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.93 2003/09/23 16:51:12 millert Exp $ */ +/* $OpenBSD: com.c,v 1.94 2003/10/03 16:44:51 miod Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -403,7 +403,6 @@ com_detach(self, flags) /* Detach and free the tty. */ if (sc->sc_tty) { - tty_detach(sc->sc_tty); ttyfree(sc->sc_tty); } @@ -483,7 +482,6 @@ comopen(dev, flag, mode, p) s = spltty(); if (!sc->sc_tty) { tp = sc->sc_tty = ttymalloc(); - tty_attach(tp); } else tp = sc->sc_tty; splx(s); diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c index 04fb4d49c20..897e889b369 100644 --- a/sys/dev/ic/cy.c +++ b/sys/dev/ic/cy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cy.c,v 1.23 2003/08/15 20:32:17 tedu Exp $ */ +/* $OpenBSD: cy.c,v 1.24 2003/10/03 16:44:51 miod Exp $ */ /* * Copyright (c) 1996 Timo Rossi. * All rights reserved. @@ -300,18 +300,11 @@ cyopen(dev, flag, mode, p) s = spltty(); if (cy->cy_tty == NULL) { - if ((cy->cy_tty = ttymalloc()) == NULL) { - splx(s); - printf("%s port %d open: can't allocate tty\n", - sc->sc_dev.dv_xname, port); - return (ENOMEM); - } + cy->cy_tty = ttymalloc(); } splx(s); tp = cy->cy_tty; - tty_attach(tp); - tp = cy->cy_tty; tp->t_oproc = cystart; tp->t_param = cyparam; tp->t_dev = dev; diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c index c414f09358f..257a86ae3c9 100644 --- a/sys/dev/ic/z8530tty.c +++ b/sys/dev/ic/z8530tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: z8530tty.c,v 1.13 2003/08/15 20:32:17 tedu Exp $ */ +/* $OpenBSD: z8530tty.c,v 1.14 2003/10/03 16:44:51 miod Exp $ */ /* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */ /* @@ -259,7 +259,6 @@ zstty_attach(parent, self, aux) tp->t_oproc = zsstart; tp->t_param = zsparam; tp->t_hwiflow = zshwiflow; - tty_attach(tp); zst->zst_tty = tp; zst->zst_rbhiwat = zstty_rbuf_size; /* impossible value */ diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c index dfd8bc4bce5..3b3929a1cc3 100644 --- a/sys/dev/pci/cz.c +++ b/sys/dev/pci/cz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cz.c,v 1.8 2003/08/15 20:32:17 tedu Exp $ */ +/* $OpenBSD: cz.c,v 1.9 2003/10/03 16:44:51 miod Exp $ */ /* $NetBSD: cz.c,v 1.15 2001/01/20 19:10:36 thorpej Exp $ */ /*- @@ -425,7 +425,6 @@ cz_attach(parent, self, aux) (cz->cz_dev.dv_unit * ZFIRM_MAX_CHANNELS) + i); tp->t_oproc = czttystart; tp->t_param = czttyparam; - tty_attach(tp); sc->sc_tty = tp; diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index 222d1860015..d210b651354 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magma.c,v 1.12 2003/09/23 16:51:12 millert Exp $ */ +/* $OpenBSD: magma.c,v 1.13 2003/10/03 16:44:51 miod Exp $ */ /* * magma.c * @@ -814,9 +814,6 @@ mtty_attach(struct device *parent, struct device *dev, void *args) mp->mp_channel = chan; tp = ttymalloc(); - if (tp == NULL) - break; - tty_attach(tp); tp->t_oproc = mtty_start; tp->t_param = mtty_param; diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c index 1bcbd07e547..b83cf859451 100644 --- a/sys/dev/sbus/spif.c +++ b/sys/dev/sbus/spif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spif.c,v 1.11 2003/09/23 16:51:12 millert Exp $ */ +/* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */ /* * Copyright (c) 1999-2002 Jason L. Wright (jason@thought.net) @@ -312,9 +312,6 @@ sttyattach(parent, dev, aux) DTR_WRITE(sc, port, 0); tp = ttymalloc(); - if (tp == NULL) - break; - tty_attach(tp); tp->t_oproc = stty_start; tp->t_param = stty_param; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 5bfb473a61d..85f48b50e2f 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.19 2003/08/15 20:32:18 tedu Exp $ */ +/* $OpenBSD: ucom.c,v 1.20 2003/10/03 16:44:51 miod Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -211,8 +211,10 @@ USB_ATTACH(ucom) tp->t_param = ucomparam; sc->sc_tty = tp; +#ifndef __OpenBSD__ DPRINTF(("ucom_attach: tty_attach %p\n", tp)); tty_attach(tp); +#endif #if defined(__NetBSD__) && NRND > 0 rnd_attach_source(&sc->sc_rndsource, USBDEVNAME(sc->sc_dev), @@ -271,7 +273,9 @@ USB_DETACH(ucom) /* Detach and free the tty. */ if (tp != NULL) { +#ifndef __OpenBSD__ tty_detach(tp); +#endif ttyfree(tp); sc->sc_tty = NULL; } diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c index b910c825fd3..5d61b70df4d 100644 --- a/sys/dev/wscons/wsdisplay.c +++ b/sys/dev/wscons/wsdisplay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplay.c,v 1.51 2003/09/23 16:51:12 millert Exp $ */ +/* $OpenBSD: wsdisplay.c,v 1.52 2003/10/03 16:44:51 miod Exp $ */ /* $NetBSD: wsdisplay.c,v 1.37.4.1 2000/06/30 16:27:53 simonb Exp $ */ /* @@ -315,7 +315,6 @@ wsscreen_attach(sc, console, emul, type, cookie, ccol, crow, defattr) scr->scr_dconf = dconf; scr->scr_tty = ttymalloc(); - tty_attach(scr->scr_tty); scr->scr_hold_screen = 0; if (WSSCREEN_HAS_EMULATOR(scr)) scr->scr_flags = 0; @@ -339,7 +338,6 @@ wsscreen_detach(scr) if (WSSCREEN_HAS_TTY(scr)) { timeout_del(&scr->scr_tty->t_rstrt_to); - tty_detach(scr->scr_tty); ttyfree(scr->scr_tty); } if (WSSCREEN_HAS_EMULATOR(scr)) |