Move setting of acpi_verbose_loaded flag into the module's init routine.

This ensures that the flag is set even if the module was manually loaded
by the user rather than just auto-loaded.
This commit is contained in:
pgoyette 2010-07-25 12:54:46 +00:00
parent c0cbdbdca3
commit 1587dcc60f
2 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi.c,v 1.207 2010/07/18 09:29:12 jruoho Exp $ */
/* $NetBSD: acpi.c,v 1.208 2010/07/25 12:54:46 pgoyette Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.207 2010/07/18 09:29:12 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.208 2010/07/25 12:54:46 pgoyette Exp $");
#include "opt_acpi.h"
#include "opt_pcifixup.h"
@ -226,13 +226,11 @@ acpi_null(void)
void
acpi_load_verbose(void)
{
if (acpi_verbose_loaded)
return;
mutex_enter(&module_lock);
if (module_autoload("acpiverbose", MODULE_CLASS_MISC) == 0)
acpi_verbose_loaded++;
mutex_exit(&module_lock);
if (acpi_verbose_loaded == 0) {
mutex_enter(&module_lock);
module_autoload("acpiverbose", MODULE_CLASS_MISC);
mutex_exit(&module_lock);
}
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_verbose.c,v 1.3 2010/06/07 01:45:27 pgoyette Exp $ */
/* $NetBSD: acpi_verbose.c,v 1.4 2010/07/25 12:54:46 pgoyette Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.3 2010/06/07 01:45:27 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.4 2010/07/25 12:54:46 pgoyette Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -103,6 +103,7 @@ acpiverbose_modcmd(modcmd_t cmd, void *arg)
acpi_print_tree = acpi_print_tree_real;
acpi_print_dev = acpi_print_dev_real;
acpi_wmidump = acpi_wmidump_real;
acpi_verbose_loaded = 1;
return 0;
case MODULE_CMD_FINI:
acpi_print_devnodes = saved_print_devnodes;