summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_tty.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2008-10-23 19:11:44 +0000
committered <ed@FreeBSD.org>2008-10-23 19:11:44 +0000
commit25ee4afba94d472eeb429076a2ead61a9e83bd1a (patch)
treeacec577b22eaf826e48ceca0820bc605a7f4322b /sys/dev/uart/uart_tty.c
parent8c20f01ac3e28933ec81429177cef25458546f2f (diff)
downloadFreeBSD-src-25ee4afba94d472eeb429076a2ead61a9e83bd1a.zip
FreeBSD-src-25ee4afba94d472eeb429076a2ead61a9e83bd1a.tar.gz
Fix detaching of uart(4) devices.
With our new TTY layer we use a two step device destruction procedure. The TTY first gets abandoned by the device driver. When the TTY layer notices all threads have left the TTY layer, it deallocates the TTY. This means that the device unit number should not be reused before a callback from the TTY layer to the device driver has been made. newbus doesn't seem to support this concept (yet), so right now just add a destructor with a big comment in it. It's not ideal, but at least it's better than panicing. Reported by: rnoland
Diffstat (limited to 'sys/dev/uart/uart_tty.c')
-rw-r--r--sys/dev/uart/uart_tty.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c
index 9b37bb3..6de5ae4 100644
--- a/sys/dev/uart/uart_tty.c
+++ b/sys/dev/uart/uart_tty.c
@@ -327,6 +327,18 @@ uart_tty_intr(void *arg)
tty_unlock(tp);
}
+static void
+uart_tty_free(void *arg)
+{
+
+ /*
+ * XXX: uart(4) could reuse the device unit number before it is
+ * being freed by the TTY layer. We should use this hook to free
+ * the device unit number, but unfortunately newbus does not
+ * seem to support such a construct.
+ */
+}
+
static struct ttydevsw uart_tty_class = {
.tsw_flags = TF_INITLOCK|TF_CALLOUT,
.tsw_open = uart_tty_open,
@@ -335,6 +347,7 @@ static struct ttydevsw uart_tty_class = {
.tsw_ioctl = uart_tty_ioctl,
.tsw_param = uart_tty_param,
.tsw_modem = uart_tty_modem,
+ .tsw_free = uart_tty_free,
};
int
OpenPOWER on IntegriCloud