Move setting of mii_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 14:44:34 +00:00
parent ddb4821198
commit 3dcc05c105
2 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mii_physubr.c,v 1.70 2010/06/06 18:58:22 pgoyette Exp $ */
/* $NetBSD: mii_physubr.c,v 1.71 2010/07/25 14:44:34 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.70 2010/06/06 18:58:22 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.71 2010/07/25 14:44:34 pgoyette Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -71,13 +71,11 @@ const char *mii_get_descr_stub(int oui, int model)
*/
void mii_load_verbose(void)
{
if (mii_verbose_loaded)
return;
mutex_enter(&module_lock);
if (module_autoload("miiverbose", MODULE_CLASS_MISC) ==0)
mii_verbose_loaded++;
mutex_exit(&module_lock);
if (mii_verbose_loaded == 0) {
mutex_enter(&module_lock);
module_autoload("miiverbose", MODULE_CLASS_MISC);
mutex_exit(&module_lock);
}
}
static void mii_phy_statusmsg(struct mii_softc *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mii_verbose.c,v 1.2 2010/06/06 18:58:22 pgoyette Exp $ */
/* $NetBSD: mii_verbose.c,v 1.3 2010/07/25 14:44:34 pgoyette Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mii_verbose.c,v 1.2 2010/06/06 18:58:22 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: mii_verbose.c,v 1.3 2010/07/25 14:44:34 pgoyette Exp $");
#include <sys/module.h>
#include <dev/mii/mii_verbose.h>
@ -81,6 +81,7 @@ miiverbose_modcmd(modcmd_t cmd, void *arg)
case MODULE_CMD_INIT:
saved_mii_get_descr = mii_get_descr;
mii_get_descr = mii_get_descr_real;
mii_verbose_loaded = 1;
return 0;
case MODULE_CMD_FINI:
mii_get_descr = saved_mii_get_descr;