Module Name:    src
Committed By:   skrll
Date:           Sun Feb  5 08:31:53 UTC 2012

Modified Files:
        src/sys/arch/hp700/dev: cpudevs_data.h devlist2h.awk
        src/sys/arch/hp700/hp700: autoconf.c

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

OK riz@


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hp700/dev/cpudevs_data.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp700/dev/devlist2h.awk
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hp700/hp700/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/arch/hp700/dev/cpudevs_data.h
diff -u src/sys/arch/hp700/dev/cpudevs_data.h:1.6 src/sys/arch/hp700/dev/cpudevs_data.h:1.7
--- src/sys/arch/hp700/dev/cpudevs_data.h:1.6	Sat Feb  4 17:05:38 2012
+++ src/sys/arch/hp700/dev/cpudevs_data.h	Sun Feb  5 08:31:53 2012
@@ -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 }

Index: src/sys/arch/hp700/dev/devlist2h.awk
diff -u src/sys/arch/hp700/dev/devlist2h.awk:1.5 src/sys/arch/hp700/dev/devlist2h.awk:1.6
--- src/sys/arch/hp700/dev/devlist2h.awk:1.5	Thu Apr 30 07:01:26 2009
+++ src/sys/arch/hp700/dev/devlist2h.awk	Sun Feb  5 08:31:53 2012
@@ -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 @@ END	{
 		print("unterminated comment at the EOF\n");
 		exit(1);
 	}
-	printf("{ -1 }\n") > cpud;
 	close(cpud)
 	close(cpuh)
 }

Index: src/sys/arch/hp700/hp700/autoconf.c
diff -u src/sys/arch/hp700/hp700/autoconf.c:1.43 src/sys/arch/hp700/hp700/autoconf.c:1.44
--- src/sys/arch/hp700/hp700/autoconf.c:1.43	Fri Jan 13 07:05:57 2012
+++ src/sys/arch/hp700/hp700/autoconf.c	Sun Feb  5 08:31:53 2012
@@ -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 @@ hppa_mod_info(int type, int sv)
 {
 	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;
 }
 
 /*

Reply via email to