Date: Sat, 1 May 2010 00:36:40 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r207454 - head/sys/compat/x86bios Message-ID: <201005010036.o410aeGj026381@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Sat May 1 00:36:40 2010 New Revision: 207454 URL: http://svn.freebsd.org/changeset/base/207454 Log: Do not initialize mutex and return error if it cannot map memory. Modified: head/sys/compat/x86bios/x86bios.c Modified: head/sys/compat/x86bios/x86bios.c ============================================================================== --- head/sys/compat/x86bios/x86bios.c Fri Apr 30 22:33:49 2010 (r207453) +++ head/sys/compat/x86bios/x86bios.c Sat May 1 00:36:40 2010 (r207454) @@ -563,15 +563,15 @@ x86bios_unmap_mem(void) contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF); } -static void -x86bios_init(void *arg __unused) +static int +x86bios_init(void) { int i; - mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN); - if (x86bios_map_mem() != 0) - return; + return (ENOMEM); + + mtx_init(&x86bios_lock, "x86bios lock", NULL, MTX_SPIN); x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF, M_WAITOK | M_ZERO); @@ -600,10 +600,12 @@ x86bios_init(void *arg __unused) for (i = 0; i < 256; i++) x86bios_emu._x86emu_intrTab[i] = x86bios_emu_get_intr; + + return (0); } -static void -x86bios_uninit(void *arg __unused) +static int +x86bios_uninit(void) { vm_offset_t *map = x86bios_map; @@ -618,6 +620,8 @@ x86bios_uninit(void *arg __unused) x86bios_unmap_mem(); mtx_destroy(&x86bios_lock); + + return (0); } static int @@ -626,16 +630,12 @@ x86bios_modevent(module_t mod __unused, switch (type) { case MOD_LOAD: - x86bios_init(NULL); - break; + return (x86bios_init()); case MOD_UNLOAD: - x86bios_uninit(NULL); - break; + return (x86bios_uninit()); default: return (ENOTSUP); } - - return (0); } static moduledata_t x86bios_mod = {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005010036.o410aeGj026381>