From owner-svn-src-head@freebsd.org Sat Jul 23 14:38:10 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C51DABA2143; Sat, 23 Jul 2016 14:38:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D0B41BC2; Sat, 23 Jul 2016 14:38:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6NEc99F075709; Sat, 23 Jul 2016 14:38:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6NEc9fG075708; Sat, 23 Jul 2016 14:38:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201607231438.u6NEc9fG075708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 23 Jul 2016 14:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303225 - head/sys/dev/fb 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.22 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: Sat, 23 Jul 2016 14:38:10 -0000 Author: jhb Date: Sat Jul 23 14:38:09 2016 New Revision: 303225 URL: https://svnweb.freebsd.org/changeset/base/303225 Log: Use MTX_SYSINIT for the VESA lock. vesa_init_done isn't a reliable guard for the mutex init. If vesa_configure() doesn't find valid VESA info it will not set vesa_init_done, but the lock will remain initialized. Revert r303076 and use MTX_SYSINIT to deterministically init the lock. Reviewed by: royger MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7290 Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Sat Jul 23 12:34:32 2016 (r303224) +++ head/sys/dev/fb/vesa.c Sat Jul 23 14:38:09 2016 (r303225) @@ -79,6 +79,7 @@ struct adp_state { typedef struct adp_state adp_state_t; static struct mtx vesa_lock; +MTX_SYSINIT(vesa_lock, &vesa_lock, "VESA lock", MTX_DEF); static int vesa_state; static void *vesa_state_buf; @@ -134,7 +135,6 @@ static vi_fill_rect_t vesa_fill_rect; static vi_bitblt_t vesa_bitblt; static vi_diag_t vesa_diag; static int vesa_bios_info(int level); -static int vesa_late_load(int flags); static video_switch_t vesavidsw = { vesa_probe, @@ -1142,7 +1142,7 @@ vesa_configure(int flags) * initialization for now and try again later. */ if (adp == NULL) { - vga_sub_configure = vesa_late_load; + vga_sub_configure = vesa_configure; return (ENODEV); } @@ -1910,27 +1910,14 @@ vesa_bios_info(int level) static int vesa_load(void) { - - return (vesa_late_load(0)); -} - -/* - * To be called from the vga_sub_configure hook in case the VGA adapter is - * not found when VESA is loaded. - */ -static int -vesa_late_load(int flags) -{ int error; if (vesa_init_done) return (0); - mtx_init(&vesa_lock, "VESA lock", NULL, MTX_DEF); - /* locate a VGA adapter */ vesa_adp = NULL; - error = vesa_configure(flags); + error = vesa_configure(0); if (error == 0) vesa_bios_info(bootverbose); @@ -1966,7 +1953,6 @@ vesa_unload(void) } vesa_bios_uninit(); - mtx_destroy(&vesa_lock); return (error); }