From owner-svn-src-head@FreeBSD.ORG Fri Feb 7 15:10:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 73DD8CC3; Fri, 7 Feb 2014 15:10:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 456EA170F; Fri, 7 Feb 2014 15:10:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s17FAPSD070328; Fri, 7 Feb 2014 15:10:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s17FAPD5070327; Fri, 7 Feb 2014 15:10:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201402071510.s17FAPD5070327@svn.freebsd.org> From: John Baldwin Date: Fri, 7 Feb 2014 15:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261600 - head/sys/dev/bvm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Feb 2014 15:10:25 -0000 Author: jhb Date: Fri Feb 7 15:10:24 2014 New Revision: 261600 URL: http://svnweb.freebsd.org/changeset/base/261600 Log: - Use a callout instead of the deprecated timeout_handle. - Set the console name always so that the bvm console device can be used via conscontrol even if it isn't chosen as the default console. Modified: head/sys/dev/bvm/bvm_console.c Modified: head/sys/dev/bvm/bvm_console.c ============================================================================== --- head/sys/dev/bvm/bvm_console.c Fri Feb 7 15:00:08 2014 (r261599) +++ head/sys/dev/bvm/bvm_console.c Fri Feb 7 15:10:24 2014 (r261600) @@ -58,8 +58,7 @@ static struct ttydevsw bvm_ttydevsw = { }; static int polltime; -static struct callout_handle bvm_timeouthandle - = CALLOUT_HANDLE_INITIALIZER(&bvm_timeouthandle); +static struct callout bvm_timer; #if defined(KDB) static int alt_break_state; @@ -107,9 +106,9 @@ cn_drvinit(void *unused) { struct tty *tp; - if (bvm_consdev.cn_pri != CN_DEAD && - bvm_consdev.cn_name[0] != '\0') { + if (bvm_consdev.cn_pri != CN_DEAD) { tp = tty_alloc(&bvm_ttydevsw, NULL); + callout_init_mtx(&bvm_timer, tty_getlock(tp), 0); tty_makedev(tp, NULL, "bvmcons"); } } @@ -120,7 +119,7 @@ bvm_tty_open(struct tty *tp) polltime = hz / BVMCONS_POLL_HZ; if (polltime < 1) polltime = 1; - bvm_timeouthandle = timeout(bvm_timeout, tp, polltime); + callout_reset(&bvm_timer, polltime, bvm_timeout, tp); return (0); } @@ -129,8 +128,9 @@ static void bvm_tty_close(struct tty *tp) { - /* XXX Should be replaced with callout_stop(9) */ - untimeout(bvm_timeout, tp, bvm_timeouthandle); + tty_lock(tp); + callout_stop(&bvm_timer); + tty_unlock(tp); } static void @@ -158,13 +158,12 @@ bvm_timeout(void *v) tp = (struct tty *)v; - tty_lock(tp); + tty_lock_assert(tp, MA_OWNED); while ((c = bvm_cngetc(NULL)) != -1) ttydisc_rint(tp, c, 0); ttydisc_rint_done(tp); - tty_unlock(tp); - bvm_timeouthandle = timeout(bvm_timeout, tp, polltime); + callout_reset(&bvm_timer, polltime, bvm_timeout, tp); } static void @@ -174,6 +173,7 @@ bvm_cnprobe(struct consdev *cp) disabled = 0; cp->cn_pri = CN_DEAD; + strcpy(cp->cn_name, "bvmcons"); resource_int_value("bvmconsole", 0, "disabled", &disabled); if (!disabled) { @@ -195,8 +195,6 @@ bvm_cninit(struct consdev *cp) for (i = 0; i < strlen(bootmsg); i++) bvm_cnputc(cp, bootmsg[i]); } - - strcpy(cp->cn_name, "bvmcons"); } static void