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

OK riz@
This commit is contained in:
skrll 2012-02-05 08:31:53 +00:00
parent afaeb265d7
commit 9b9495d4e1
3 changed files with 15 additions and 11 deletions

View File

@ -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 }

View File

@ -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)
}

View File

@ -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,14 +649,20 @@ 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;
}