clean up error handling in TC graphics console attachment: all functions

return 0 on success and an errno on failure
This commit is contained in:
drochner 1999-08-07 12:58:27 +00:00
parent d6fd5e2c88
commit f6f48ed7e7
6 changed files with 28 additions and 29 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_3000_300.c,v 1.26 1999/04/15 22:06:47 thorpej Exp $ */ /* $NetBSD: dec_3000_300.c,v 1.27 1999/08/07 12:58:27 drochner Exp $ */
/* /*
* Copyright (c) 1995, 1996 Carnegie-Mellon University. * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -33,7 +33,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_3000_300.c,v 1.26 1999/04/15 22:06:47 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: dec_3000_300.c,v 1.27 1999/08/07 12:58:27 drochner Exp $");
#include "opt_new_scc_driver.h" #include "opt_new_scc_driver.h"
@ -102,9 +102,9 @@ dec_3000_300_cons_init()
case CTB_GRAPHICS: case CTB_GRAPHICS:
#if NWSDISPLAY > 0 #if NWSDISPLAY > 0
/* display console ... */ /* display console ... */
if (zs_ioasic_lk201_cnattach(0x1a0000000, 0x00180000, 0) && if (zs_ioasic_lk201_cnattach(0x1a0000000, 0x00180000, 0) == 0 &&
tc_3000_300_fb_cnattach( tc_3000_300_fb_cnattach(
CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot))) { CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot)) == 0) {
break; break;
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_3000_500.c,v 1.25 1999/04/15 22:06:47 thorpej Exp $ */ /* $NetBSD: dec_3000_500.c,v 1.26 1999/08/07 12:58:28 drochner Exp $ */
/* /*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: dec_3000_500.c,v 1.25 1999/04/15 22:06:47 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: dec_3000_500.c,v 1.26 1999/08/07 12:58:28 drochner Exp $");
#include "opt_new_scc_driver.h" #include "opt_new_scc_driver.h"
@ -122,9 +122,9 @@ dec_3000_500_cons_init()
case CTB_GRAPHICS: case CTB_GRAPHICS:
#if NWSDISPLAY > 0 #if NWSDISPLAY > 0
/* display console ... */ /* display console ... */
if (zs_ioasic_lk201_cnattach(0x1e0000000, 0x00180000, 0) && if (zs_ioasic_lk201_cnattach(0x1e0000000, 0x00180000, 0) == 0 &&
tc_3000_500_fb_cnattach( tc_3000_500_fb_cnattach(
CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot))) { CTB_TURBOSLOT_SLOT(ctb->ctb_turboslot)) == 0) {
break; break;
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: tc_3000_300.c,v 1.19 1999/03/28 13:48:40 drochner Exp $ */ /* $NetBSD: tc_3000_300.c,v 1.20 1999/08/07 12:58:29 drochner Exp $ */
/* /*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.19 1999/03/28 13:48:40 drochner Exp $"); __KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.20 1999/08/07 12:58:29 drochner Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -284,15 +284,15 @@ tc_3000_300_fb_cnattach(turbo_slot)
output_slot = turbo_slot & 0xffffffff; output_slot = turbo_slot & 0xffffffff;
if (output_slot >= tc_3000_300_nslots) { if (output_slot >= tc_3000_300_nslots) {
return 0; return EINVAL;
} }
if (output_slot == 0) { if (output_slot == 0) {
#if NSFB > 0 #if NSFB > 0
sfb_cnattach(KV(0x1c0000000) + 0x02000000); sfb_cnattach(KV(0x1c0000000) + 0x02000000);
return 1;
#else
return 0; return 0;
#else
return ENXIO;
#endif #endif
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: tc_3000_500.c,v 1.19 1999/03/28 13:48:40 drochner Exp $ */ /* $NetBSD: tc_3000_500.c,v 1.20 1999/08/07 12:58:29 drochner Exp $ */
/* /*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.19 1999/03/28 13:48:40 drochner Exp $"); __KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.20 1999/08/07 12:58:29 drochner Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -284,16 +284,16 @@ tc_3000_500_fb_cnattach(turbo_slot)
output_slot = turbo_slot & 0xffffffff; output_slot = turbo_slot & 0xffffffff;
if (output_slot >= tc_3000_500_nslots) { if (output_slot >= tc_3000_500_nslots) {
return 0; return EINVAL;
} }
if (hwrpb->rpb_variation & SV_GRAPHICS) { if (hwrpb->rpb_variation & SV_GRAPHICS) {
if (output_slot == 0) { if (output_slot == 0) {
#if NSFB > 0 #if NSFB > 0
sfb_cnattach(KV(0x1e0000000) + 0x02000000); sfb_cnattach(KV(0x1e0000000) + 0x02000000);
return 1;
#else
return 0; return 0;
#else
return ENXIO;
#endif #endif
} }
} else { } else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcasic.c,v 1.26 1999/04/10 01:21:38 cgd Exp $ */ /* $NetBSD: tcasic.c,v 1.27 1999/08/07 12:58:29 drochner Exp $ */
/* /*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.26 1999/04/10 01:21:38 cgd Exp $"); __KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.27 1999/08/07 12:58:29 drochner Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -189,21 +189,21 @@ tc_fb_cnattach(tcaddr)
char tcname[TC_ROM_LLEN]; char tcname[TC_ROM_LLEN];
if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0)) { if (tc_badaddr(tcaddr) || (tc_checkslot(tcaddr, tcname) == 0)) {
return 0; return EINVAL;
} }
#if NSFB > 0 #if NSFB > 0
if (strncmp("PMAGB-BA", tcname, TC_ROM_LLEN) == 0) { if (strncmp("PMAGB-BA", tcname, TC_ROM_LLEN) == 0) {
sfb_cnattach(tcaddr); sfb_cnattach(tcaddr);
return 1; return 0;
} }
#endif #endif
#if NCFB > 0 #if NCFB > 0
if (strncmp("PMAG-BA ", tcname, TC_ROM_LLEN) == 0) { if (strncmp("PMAG-BA ", tcname, TC_ROM_LLEN) == 0) {
cfb_cnattach(tcaddr); cfb_cnattach(tcaddr);
return 1; return 0;
} }
#endif #endif
return 0; return ENXIO;
} }
#endif /* if NWSDISPLAY > 0 */ #endif /* if NWSDISPLAY > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: zs_ioasic.c,v 1.6 1999/08/03 05:30:56 nisimura Exp $ */ /* $NetBSD: zs_ioasic.c,v 1.7 1999/08/07 12:58:30 drochner Exp $ */
/*- /*-
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.6 1999/08/03 05:30:56 nisimura Exp $"); __KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.7 1999/08/07 12:58:30 drochner Exp $");
/* /*
* Zilog Z8530 Dual UART driver (machine-dependent part). This driver * Zilog Z8530 Dual UART driver (machine-dependent part). This driver
@ -819,10 +819,9 @@ zs_ioasic_lk201_cnattach(ioasic_addr, zs_offset, channel)
zs_ioasic_conschanstate->cs_defcflag = zs_ioasic_conschanstate->cs_defcflag =
(TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8; (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8;
zs_ioasic_conschanstate->cs_brg_clk = PCLK / 16; zs_ioasic_conschanstate->cs_brg_clk = PCLK / 16;
zskbd_cnattach(zs_ioasic_conschanstate); return (zskbd_cnattach(zs_ioasic_conschanstate));
return (1);
#else #else
return (0); return (ENXIO);
#endif #endif
} }