Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Oct 2008 19:11:44 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184208 - head/sys/dev/uart
Message-ID:  <200810231911.m9NJBisd064280@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Thu Oct 23 19:11:44 2008
New Revision: 184208
URL: http://svn.freebsd.org/changeset/base/184208

Log:
  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

Modified:
  head/sys/dev/uart/uart_tty.c

Modified: head/sys/dev/uart/uart_tty.c
==============================================================================
--- head/sys/dev/uart/uart_tty.c	Thu Oct 23 18:30:06 2008	(r184207)
+++ head/sys/dev/uart/uart_tty.c	Thu Oct 23 19:11:44 2008	(r184208)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810231911.m9NJBisd064280>