Put all console initialization into 1 exported function (pccnattach()).

Delay setting of cn_tab->cn_dev until autoconfiguration attach
  to get the minor number right.
Delete unused pccnprobe() and pccninit().
This commit is contained in:
drochner 1997-08-23 14:10:12 +00:00
parent f4e17ffbfe
commit fe882d2810
2 changed files with 25 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.h,v 1.5 1997/08/14 16:02:14 drochner Exp $ */ /* $NetBSD: pccons.h,v 1.6 1997/08/23 14:10:15 drochner Exp $ */
/* /*
* pccons.h -- pccons ioctl definitions * pccons.h -- pccons ioctl definitions
@ -15,10 +15,7 @@
#define CONSOLE_SET_TYPEMATIC_RATE _IOW('t',124,u_char) #define CONSOLE_SET_TYPEMATIC_RATE _IOW('t',124,u_char)
#ifdef _KERNEL #ifdef _KERNEL
int pccngetc __P((dev_t)); int pccnattach __P((void));
void pccnputc __P((dev_t, int));
void pccnpollc __P((dev_t, int));
void pccninit __P((struct consdev *));
#endif #endif
#endif /* _PCCONS_H_ */ #endif /* _PCCONS_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pccons.c,v 1.109 1997/08/14 16:02:16 drochner Exp $ */ /* $NetBSD: pccons.c,v 1.110 1997/08/23 14:10:12 drochner Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved. * Copyright (c) 1993, 1994, 1995 Charles Hannum. All rights reserved.
@ -532,6 +532,21 @@ pcattach(parent, self, aux)
*/ */
while (config_found(self, ia->ia_ic, NULL) != NULL) /* XXX */ while (config_found(self, ia->ia_ic, NULL) != NULL) /* XXX */
/* will break when no more children */ ; /* will break when no more children */ ;
if(pccons_is_console) {
int maj;
/* locate the major number */
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == pcopen)
break;
cn_tab->cn_dev = makedev(maj, sc->sc_dev.dv_unit);
/* there can be only one, but it can have any
unit number */
printf("%s: console\n", sc->sc_dev.dv_xname);
}
} }
int int
@ -766,32 +781,17 @@ pcstop(tp, flag)
} }
void int
pccnprobe(cp) pccnattach()
struct consdev *cp;
{ {
int maj; static struct consdev pccons = { NULL, NULL,
pccngetc, pccnputc, pccnpollc, NODEV, CN_NORMAL};
/* locate the major number */ cn_tab = &pccons;
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == pcopen)
break;
/* initialize required fields */
cp->cn_dev = makedev(maj, 0);
cp->cn_pri = CN_INTERNAL;
}
/* ARGSUSED */
void
pccninit(cp)
struct consdev *cp;
{
pccons_is_console = 1; pccons_is_console = 1;
/*
* For now, don't screw with it. return(0);
*/
/* crtat = 0; */
} }
/* ARGSUSED */ /* ARGSUSED */