From owner-svn-src-all@FreeBSD.ORG Thu Oct 23 19:11:44 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97B481065679; Thu, 23 Oct 2008 19:11:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86BC58FC0A; Thu, 23 Oct 2008 19:11:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9NJBiDm064281; Thu, 23 Oct 2008 19:11:44 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9NJBisd064280; Thu, 23 Oct 2008 19:11:44 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200810231911.m9NJBisd064280@svn.freebsd.org> From: Ed Schouten Date: Thu, 23 Oct 2008 19:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184208 - head/sys/dev/uart X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2008 19:11:44 -0000 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