ANSI, KNF, use __arraycount.
This commit is contained in:
parent
499d835e35
commit
3bd86dc17d
@ -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>
|
#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/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -27,23 +27,18 @@ CFATTACH_DECL(vesatext, sizeof(struct vesatextsc),
|
|||||||
vesatext_match, vesatext_attach, NULL, NULL);
|
vesatext_match, vesatext_attach, NULL, NULL);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vesatext_match(parent, match, aux)
|
vesatext_match(struct device *parent, struct cfdata *match, void *aux)
|
||||||
struct device *parent;
|
|
||||||
struct cfdata *match;
|
|
||||||
void *aux;
|
|
||||||
{
|
{
|
||||||
struct vesabiosdev_attach_args *vaa = aux;
|
struct vesabiosdev_attach_args *vaa = aux;
|
||||||
|
|
||||||
if (strcmp(vaa->vbaa_type, "text"))
|
if (strcmp(vaa->vbaa_type, "text"))
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vesatext_attach(parent, dev, aux)
|
vesatext_attach(struct device *parent, struct device *dev, void *aux)
|
||||||
struct device *parent, *dev;
|
|
||||||
void *aux;
|
|
||||||
{
|
{
|
||||||
struct vesatextsc *sc = (struct vesatextsc *)dev;
|
struct vesatextsc *sc = (struct vesatextsc *)dev;
|
||||||
struct vesabiosdev_attach_args *vaa = aux;
|
struct vesabiosdev_attach_args *vaa = aux;
|
||||||
|
@ -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
|
* Copyright (c) 2002, 2004
|
||||||
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -74,12 +74,11 @@ vesabios_match( struct device *parent, struct cfdata *match,
|
|||||||
void *aux)
|
void *aux)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vbegetinfo(vip)
|
vbegetinfo(struct vbeinfoblock **vip)
|
||||||
struct vbeinfoblock **vip;
|
|
||||||
{
|
{
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
struct trapframe tf;
|
struct trapframe tf;
|
||||||
@ -88,7 +87,7 @@ vbegetinfo(vip)
|
|||||||
buf = kvm86_bios_addpage(0x2000);
|
buf = kvm86_bios_addpage(0x2000);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
printf("vbegetinfo: kvm86_bios_addpage(0x2000) failed\n");
|
printf("vbegetinfo: kvm86_bios_addpage(0x2000) failed\n");
|
||||||
return (ENOMEM);
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buf, "VBE2", 4);
|
memcpy(buf, "VBE2", 4);
|
||||||
@ -112,36 +111,34 @@ vbegetinfo(vip)
|
|||||||
|
|
||||||
if (vip)
|
if (vip)
|
||||||
*vip = (struct vbeinfoblock *)buf;
|
*vip = (struct vbeinfoblock *)buf;
|
||||||
return (0);
|
return 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
kvm86_bios_delpage(0x2000, buf);
|
kvm86_bios_delpage(0x2000, buf);
|
||||||
return (error);
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vbefreeinfo(vip)
|
vbefreeinfo(struct vbeinfoblock *vip)
|
||||||
struct vbeinfoblock *vip;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
kvm86_bios_delpage(0x2000, vip);
|
kvm86_bios_delpage(0x2000, vip);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vbeprobe()
|
vbeprobe(void)
|
||||||
{
|
{
|
||||||
struct vbeinfoblock *vi;
|
struct vbeinfoblock *vi;
|
||||||
|
|
||||||
if (vbegetinfo(&vi))
|
if (vbegetinfo(&vi))
|
||||||
return (0);
|
return 0;
|
||||||
vbefreeinfo(vi);
|
vbefreeinfo(vi);
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VESABIOSVERBOSE
|
#ifdef VESABIOSVERBOSE
|
||||||
static const char *
|
static const char *
|
||||||
mm2txt(mm)
|
mm2txt(unsigned int mm)
|
||||||
unsigned int mm;
|
|
||||||
{
|
{
|
||||||
static char buf[30];
|
static char buf[30];
|
||||||
static const char *names[] = {
|
static const char *names[] = {
|
||||||
@ -155,10 +152,10 @@ mm2txt(mm)
|
|||||||
"YUV"
|
"YUV"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mm < sizeof(names)/sizeof(names[0]))
|
if (mm < __arraycount(names))
|
||||||
return (names[mm]);
|
return names[mm];
|
||||||
snprintf(buf, sizeof(buf), "unknown memory model %d", mm);
|
snprintf(buf, sizeof(buf), "unknown memory model %d", mm);
|
||||||
return (buf);
|
return buf;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -292,13 +289,11 @@ vesabios_attach(struct device *parent, struct device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vesabios_print(aux, pnp)
|
vesabios_print(void *aux, const char *pnp)
|
||||||
void *aux;
|
|
||||||
const char *pnp;
|
|
||||||
{
|
{
|
||||||
struct vesabiosdev_attach_args *vbaa = aux;
|
struct vesabiosdev_attach_args *vbaa = aux;
|
||||||
|
|
||||||
if (pnp)
|
if (pnp)
|
||||||
aprint_normal("%s at %s", vbaa->vbaa_type, pnp);
|
aprint_normal("%s at %s", vbaa->vbaa_type, pnp);
|
||||||
return (UNCONF);
|
return UNCONF;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user