Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Move setting of the usb_verbose_loaded flag into...



details:   https://anonhg.NetBSD.org/src/rev/e264fc133acf
branches:  trunk
changeset: 756585:e264fc133acf
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jul 25 13:19:27 2010 +0000

description:
Move setting of the usb_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.

diffstat:

 sys/dev/usb/usb_subr.c    |  16 +++++++---------
 sys/dev/usb/usb_verbose.c |   5 +++--
 2 files changed, 10 insertions(+), 11 deletions(-)

diffs (63 lines):

diff -r 89955a8ceafd -r e264fc133acf sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Sun Jul 25 12:54:46 2010 +0000
+++ b/sys/dev/usb/usb_subr.c    Sun Jul 25 13:19:27 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.172 2010/07/20 20:56:06 drochner Exp $  */
+/*     $NetBSD: usb_subr.c,v 1.173 2010/07/25 13:19:27 pgoyette Exp $  */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.172 2010/07/20 20:56:06 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.173 2010/07/25 13:19:27 pgoyette Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usbverbose.h"
@@ -122,13 +122,11 @@
  */
 void usb_load_verbose(void)
 {
-       if (usb_verbose_loaded)
-               return;
-
-       mutex_enter(&module_lock);
-       if (module_autoload("usbverbose", MODULE_CLASS_MISC) == 0)
-               usb_verbose_loaded++;
-       mutex_exit(&module_lock);
+       if (usb_verbose_loaded == 0) {
+               mutex_enter(&module_lock);
+               module_autoload("usbverbose", MODULE_CLASS_MISC);
+               mutex_exit(&module_lock);
+       }
 }
 
 void get_usb_vendor_stub(char *v, usb_vendor_id_t v_id)
diff -r 89955a8ceafd -r e264fc133acf sys/dev/usb/usb_verbose.c
--- a/sys/dev/usb/usb_verbose.c Sun Jul 25 12:54:46 2010 +0000
+++ b/sys/dev/usb/usb_verbose.c Sun Jul 25 13:19:27 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_verbose.c,v 1.2 2010/06/06 18:58:26 pgoyette Exp $ */
+/*     $NetBSD: usb_verbose.c,v 1.3 2010/07/25 13:19:27 pgoyette Exp $ */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_verbose.c,v 1.2 2010/06/06 18:58:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_verbose.c,v 1.3 2010/07/25 13:19:27 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/module.h>
@@ -74,6 +74,7 @@
                saved_usb_product = get_usb_product;
                get_usb_vendor = get_usb_vendor_real;
                get_usb_product = get_usb_product_real;
+               usb_verbose_loaded = 1;
                return 0;
        case MODULE_CMD_FINI:
                get_usb_vendor = saved_usb_vendor;



Home | Main Index | Thread Index | Old Index