Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Tweak a bit and add some comments.



details:   https://anonhg.NetBSD.org/src/rev/f3daa99457b8
branches:  trunk
changeset: 936047:f3daa99457b8
user:      uwe <uwe%NetBSD.org@localhost>
date:      Fri Jul 17 02:16:57 2020 +0000

description:
Tweak a bit and add some comments.

Same object code is generated.

diffstat:

 sys/dev/cninit.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (58 lines):

diff -r 7da11fc1e999 -r f3daa99457b8 sys/dev/cninit.c
--- a/sys/dev/cninit.c  Fri Jul 17 02:05:44 2020 +0000
+++ b/sys/dev/cninit.c  Fri Jul 17 02:16:57 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cninit.c,v 1.12 2020/07/17 02:05:44 uwe Exp $  */
+/*     $NetBSD: cninit.c,v 1.13 2020/07/17 02:16:57 uwe Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cninit.c,v 1.12 2020/07/17 02:05:44 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cninit.c,v 1.13 2020/07/17 02:16:57 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -56,14 +56,16 @@
 void
 cninit(void)
 {
+       struct consdev *bestMatch;
        struct consdev *cp;
-       struct consdev *bestMatch;
 
-       bestMatch = cn_tab = NULL;
+       cn_tab = NULL;
+
        /*
         * Collect information about all possible consoles
         * and find the one with highest priority
         */
+       bestMatch = NULL;
        for (cp = constab; cp->cn_probe; cp++) {
                (*cp->cn_probe)(cp);
                if (cp->cn_pri > CN_DEAD &&
@@ -82,16 +84,19 @@
         * Turn on console
         */
        {
+               /* XXX: can this ever be non-NULL? */
                struct consdev *old_cn_tab = cn_tab;
 
+               /* cn_init may set cn_tab to self */
                (*bestMatch->cn_init)(bestMatch);
+
                /*
                 * Now let everyone know we have an active console they can
                 * use for diagnostics. If we use cn_tab in the search loop
                 * then interrupts from the ethernet at boot may cause system
                 * hang.
                 */
-               if (cn_tab == old_cn_tab)
+               if (cn_tab == old_cn_tab) /* if cn_init didn't, set it */
                        cn_tab = bestMatch;
        }
 }



Home | Main Index | Thread Index | Old Index