ANSI, KNF, use __arraycount.

This commit is contained in:
xtraeme 2007-02-20 00:09:57 +00:00
parent 499d835e35
commit 3bd86dc17d
2 changed files with 23 additions and 33 deletions

View File

@ -1,7 +1,7 @@
/* $NetBSD: vesa_text.c,v 1.7 2006/02/19 14:59:22 thorpej Exp $ */
/* $NetBSD: vesa_text.c,v 1.8 2007/02/20 00:09:57 xtraeme Exp $ */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vesa_text.c,v 1.7 2006/02/19 14:59:22 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: vesa_text.c,v 1.8 2007/02/20 00:09:57 xtraeme Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -27,23 +27,18 @@ CFATTACH_DECL(vesatext, sizeof(struct vesatextsc),
vesatext_match, vesatext_attach, NULL, NULL);
static int
vesatext_match(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
vesatext_match(struct device *parent, struct cfdata *match, void *aux)
{
struct vesabiosdev_attach_args *vaa = aux;
if (strcmp(vaa->vbaa_type, "text"))
return (0);
return 0;
return (1);
return 1;
}
static void
vesatext_attach(parent, dev, aux)
struct device *parent, *dev;
void *aux;
vesatext_attach(struct device *parent, struct device *dev, void *aux)
{
struct vesatextsc *sc = (struct vesatextsc *)dev;
struct vesabiosdev_attach_args *vaa = aux;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vesabios.c,v 1.22 2006/11/16 01:32:38 christos Exp $ */
/* $NetBSD: vesabios.c,v 1.23 2007/02/20 00:09:57 xtraeme Exp $ */
/*
* Copyright (c) 2002, 2004
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vesabios.c,v 1.22 2006/11/16 01:32:38 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vesabios.c,v 1.23 2007/02/20 00:09:57 xtraeme Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -74,12 +74,11 @@ vesabios_match( struct device *parent, struct cfdata *match,
void *aux)
{
return (1);
return 1;
}
static int
vbegetinfo(vip)
struct vbeinfoblock **vip;
vbegetinfo(struct vbeinfoblock **vip)
{
unsigned char *buf;
struct trapframe tf;
@ -88,7 +87,7 @@ vbegetinfo(vip)
buf = kvm86_bios_addpage(0x2000);
if (!buf) {
printf("vbegetinfo: kvm86_bios_addpage(0x2000) failed\n");
return (ENOMEM);
return ENOMEM;
}
memcpy(buf, "VBE2", 4);
@ -112,36 +111,34 @@ vbegetinfo(vip)
if (vip)
*vip = (struct vbeinfoblock *)buf;
return (0);
return 0;
out:
kvm86_bios_delpage(0x2000, buf);
return (error);
return error;
}
static void
vbefreeinfo(vip)
struct vbeinfoblock *vip;
vbefreeinfo(struct vbeinfoblock *vip)
{
kvm86_bios_delpage(0x2000, vip);
}
int
vbeprobe()
vbeprobe(void)
{
struct vbeinfoblock *vi;
if (vbegetinfo(&vi))
return (0);
return 0;
vbefreeinfo(vi);
return (1);
return 1;
}
#ifdef VESABIOSVERBOSE
static const char *
mm2txt(mm)
unsigned int mm;
mm2txt(unsigned int mm)
{
static char buf[30];
static const char *names[] = {
@ -155,10 +152,10 @@ mm2txt(mm)
"YUV"
};
if (mm < sizeof(names)/sizeof(names[0]))
return (names[mm]);
if (mm < __arraycount(names))
return names[mm];
snprintf(buf, sizeof(buf), "unknown memory model %d", mm);
return (buf);
return buf;
}
#endif
@ -292,13 +289,11 @@ vesabios_attach(struct device *parent, struct device *dev,
}
static int
vesabios_print(aux, pnp)
void *aux;
const char *pnp;
vesabios_print(void *aux, const char *pnp)
{
struct vesabiosdev_attach_args *vbaa = aux;
if (pnp)
aprint_normal("%s at %s", vbaa->vbaa_type, pnp);
return (UNCONF);
return UNCONF;
}