Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp700 Use __arraycount on hppa_knownmods rather tha...



details:   https://anonhg.NetBSD.org/src/rev/77651ede529b
branches:  trunk
changeset: 773534:77651ede529b
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Feb 05 08:31:53 2012 +0000

description:
Use __arraycount on hppa_knownmods rather than end-of-table record.

OK riz@

diffstat:

 sys/arch/hp700/dev/cpudevs_data.h |   3 +--
 sys/arch/hp700/dev/devlist2h.awk  |   3 +--
 sys/arch/hp700/hp700/autoconf.c   |  20 +++++++++++++-------
 3 files changed, 15 insertions(+), 11 deletions(-)

diffs (76 lines):

diff -r f04d60e4a447 -r 77651ede529b sys/arch/hp700/dev/cpudevs_data.h
--- a/sys/arch/hp700/dev/cpudevs_data.h Sun Feb 05 08:27:37 2012 +0000
+++ b/sys/arch/hp700/dev/cpudevs_data.h Sun Feb 05 08:31:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpudevs_data.h,v 1.6 2012/02/04 17:05:38 skrll Exp $   */
+/*     $NetBSD: cpudevs_data.h,v 1.7 2012/02/05 08:31:53 skrll Exp $   */
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
@@ -354,4 +354,3 @@
 {HPPA_TYPE_FABRIC,     HPPA_FABRIC_DNACA,      "Halfdome DNA Central Agent" },
 {HPPA_TYPE_FABRIC,     HPPA_FABRIC_TOGO,       "Halfdome TOGO Fabric Crossbar" },
 {HPPA_TYPE_FABRIC,     HPPA_FABRIC_SAKURA,     "Halfdome Sakura Fabric Router" },
-{ -1 }
diff -r f04d60e4a447 -r 77651ede529b sys/arch/hp700/dev/devlist2h.awk
--- a/sys/arch/hp700/dev/devlist2h.awk  Sun Feb 05 08:27:37 2012 +0000
+++ b/sys/arch/hp700/dev/devlist2h.awk  Sun Feb 05 08:31:53 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: devlist2h.awk,v 1.5 2009/04/30 07:01:26 skrll Exp $
+#      $NetBSD: devlist2h.awk,v 1.6 2012/02/05 08:31:53 skrll Exp $
 
 #      $OpenBSD: devlist2h.awk,v 1.6 2004/04/07 18:24:19 mickey Exp $
 
@@ -122,7 +122,6 @@
                print("unterminated comment at the EOF\n");
                exit(1);
        }
-       printf("{ -1 }\n") > cpud;
        close(cpud)
        close(cpuh)
 }
diff -r f04d60e4a447 -r 77651ede529b sys/arch/hp700/hp700/autoconf.c
--- a/sys/arch/hp700/hp700/autoconf.c   Sun Feb 05 08:27:37 2012 +0000
+++ b/sys/arch/hp700/hp700/autoconf.c   Sun Feb 05 08:31:53 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.43 2012/01/13 07:05:57 skrll Exp $      */
+/*     $NetBSD: autoconf.c,v 1.44 2012/02/05 08:31:53 skrll Exp $      */
 
 /*     $OpenBSD: autoconf.c,v 1.15 2001/06/25 00:43:10 mickey Exp $    */
 
@@ -86,7 +86,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.43 2012/01/13 07:05:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.44 2012/02/05 08:31:53 skrll Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_useleds.h"
@@ -649,15 +649,21 @@
 {
        const struct hppa_mod_info *mi;
        static char fakeid[32];
+       int i;
 
-       for (mi = hppa_knownmods; mi->mi_type >= 0 &&
-            (mi->mi_type != type || mi->mi_sv != sv); mi++);
+       for (i = 0, mi = hppa_knownmods; i < __arraycount(hppa_knownmods);
+           i++, mi++) {
+               if (mi->mi_type == type && mi->mi_sv == sv) {
+                       break;
+               }
+       }
 
-       if (mi->mi_type < 0) {
+       if (i == __arraycount(hppa_knownmods)) {
                sprintf(fakeid, "type %x, sv %x", type, sv);
                return fakeid;
-       } else
-               return mi->mi_name;
+       }
+
+       return mi->mi_name;
 }
 
 /*



Home | Main Index | Thread Index | Old Index