Module Name:    src
Committed By:   martin
Date:           Sun Jul 30 12:04:22 UTC 2023

Modified Files:
        src/sys/kern [netbsd-10]: subr_autoconf.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #260):

        sys/kern/subr_autoconf.c: revision 1.314

autoconf(9): Print `waiting for devices' normally once a minute.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.306.4.1 src/sys/kern/subr_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.306 src/sys/kern/subr_autoconf.c:1.306.4.1
--- src/sys/kern/subr_autoconf.c:1.306	Tue Sep 13 09:43:33 2022
+++ src/sys/kern/subr_autoconf.c	Sun Jul 30 12:04:22 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.306 2022/09/13 09:43:33 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.306.4.1 2023/07/30 12:04:22 martin Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.306 2022/09/13 09:43:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.306.4.1 2023/07/30 12:04:22 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2539,6 +2539,7 @@ config_finalize(void)
 	struct finalize_hook *f;
 	struct pdevinit *pdev;
 	extern struct pdevinit pdevinit[];
+	unsigned t0 = getticks();
 	int errcnt, rv;
 
 	/*
@@ -2547,17 +2548,27 @@ config_finalize(void)
 	 */
 	mutex_enter(&config_misc_lock);
 	while (!TAILQ_EMPTY(&config_pending)) {
-		device_t dev;
-		int error;
+		const unsigned t1 = getticks();
 
-		error = cv_timedwait(&config_misc_cv, &config_misc_lock,
-		    mstohz(1000));
-		if (error == EWOULDBLOCK) {
-			aprint_debug("waiting for devices:");
+		if (t1 - t0 >= hz) {
+			void (*pr)(const char *, ...) __printflike(1,2);
+			device_t dev;
+
+			if (t1 - t0 >= 60*hz) {
+				pr = aprint_normal;
+				t0 = t1;
+			} else {
+				pr = aprint_debug;
+			}
+
+			(*pr)("waiting for devices:");
 			TAILQ_FOREACH(dev, &config_pending, dv_pending_list)
-				aprint_debug(" %s", device_xname(dev));
-			aprint_debug("\n");
+				(*pr)(" %s", device_xname(dev));
+			(*pr)("\n");
 		}
+
+		(void)cv_timedwait(&config_misc_cv, &config_misc_lock,
+		    mstohz(1000));
 	}
 	mutex_exit(&config_misc_lock);
 

Reply via email to