From 1587dcc60f1639a0b55a5eef56997dafc98653af Mon Sep 17 00:00:00 2001 From: pgoyette Date: Sun, 25 Jul 2010 12:54:46 +0000 Subject: [PATCH] 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. --- sys/dev/acpi/acpi.c | 16 +++++++--------- sys/dev/acpi/acpi_verbose.c | 5 +++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 36201b011c42..3e86c7563e10 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -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 -__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 diff --git a/sys/dev/acpi/acpi_verbose.c b/sys/dev/acpi/acpi_verbose.c index 75fa6b658de9..9033413b43a7 100644 --- a/sys/dev/acpi/acpi_verbose.c +++ b/sys/dev/acpi/acpi_verbose.c @@ -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 -__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 #include @@ -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;