diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-08-28 12:47:13 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-08-28 12:47:13 +0000 |
commit | e141fb7001e71fe81f6968549e363c111add17b2 (patch) | |
tree | 586554ac67cb96b2e1cff91c8efe9e8ba0695e70 /sys/dev | |
parent | bcea6b031570430915bf88ebd787dd2fa49bc8bd (diff) |
Remove dead code, ansify, and clean the match routine; adapted from a diff
by Alexandr Shadchin (firstname dot lastname at gmail) on tech@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/isa/pckbc_isa.c | 65 |
1 files changed, 25 insertions, 40 deletions
diff --git a/sys/dev/isa/pckbc_isa.c b/sys/dev/isa/pckbc_isa.c index cc4785385e2..130dba6e477 100644 --- a/sys/dev/isa/pckbc_isa.c +++ b/sys/dev/isa/pckbc_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc_isa.c,v 1.7 2010/07/22 14:27:46 deraadt Exp $ */ +/* $OpenBSD: pckbc_isa.c,v 1.8 2010/08/28 12:47:12 miod Exp $ */ /* $NetBSD: pckbc_isa.c,v 1.2 2000/03/23 07:01:35 thorpej Exp $ */ /* @@ -29,16 +29,12 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/proc.h> #include <sys/device.h> -#include <sys/malloc.h> -#include <sys/errno.h> -#include <sys/queue.h> -#include <sys/lock.h> +#include <sys/malloc.h> #include <machine/bus.h> -#include <dev/isa/isareg.h> +#include <dev/isa/isareg.h> #include <dev/isa/isavar.h> #include <dev/ic/i8042reg.h> @@ -63,15 +59,12 @@ struct cfattach pckbc_isa_ca = { void pckbc_isa_intr_establish(struct pckbc_softc *, pckbc_slot_t); int -pckbc_isa_match(parent, match, aux) - struct device *parent; - void *match; - void *aux; +pckbc_isa_match(struct device *parent, void *match, void *aux) { struct isa_attach_args *ia = aux; bus_space_tag_t iot = ia->ia_iot; bus_space_handle_t ioh_d, ioh_c; - int res, ok = 1; + int res; /* If values are hardwired to something that they can't be, punt. */ if ((ia->ia_iobase != IOBASEUNK && ia->ia_iobase != IO_KBD) || @@ -83,35 +76,35 @@ pckbc_isa_match(parent, match, aux) if (pckbc_is_console(iot, IO_KBD) == 0) { if (bus_space_map(iot, IO_KBD + KBDATAP, 1, 0, &ioh_d)) return (0); - if (bus_space_map(iot, IO_KBD + KBCMDP, 1, 0, &ioh_c)) { - bus_space_unmap(iot, ioh_d, 1); - return (0); - } + if (bus_space_map(iot, IO_KBD + KBCMDP, 1, 0, &ioh_c)) + goto fail; /* flush KBC */ (void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0); /* KBC selftest */ - if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) { - ok = 0; - goto out; - } + if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) + goto fail2; res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0); if (res != 0x55) { printf("kbc selftest: %x\n", res); - ok = 0; + goto fail2; } - out: - bus_space_unmap(iot, ioh_d, 1); bus_space_unmap(iot, ioh_c, 1); + bus_space_unmap(iot, ioh_d, 1); } - if (ok) { - ia->ia_iobase = IO_KBD; - ia->ia_iosize = 5; - ia->ia_msize = 0x0; - } - return (ok); + ia->ia_iobase = IO_KBD; + ia->ia_iosize = 5; + ia->ia_msize = 0x0; + + return (1); + +fail2: + bus_space_unmap(iot, ioh_c, 1); +fail: + bus_space_unmap(iot, ioh_d, 1); + return (0); } int @@ -132,9 +125,7 @@ pckbc_isa_activate(struct device *self, int act) } void -pckbc_isa_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +pckbc_isa_attach(struct device *parent, struct device *self, void *aux) { struct pckbc_isa_softc *isc = (void *)self; struct pckbc_softc *sc = &isc->sc_pckbc; @@ -149,8 +140,6 @@ pckbc_isa_attach(parent, self, aux) /* * Set up IRQs for "normal" ISA. - * - * XXX The "aux" slot is different (9) on the Alpha AXP150 Jensen. */ isc->sc_irq[PCKBC_KBD_SLOT] = 1; isc->sc_irq[PCKBC_AUX_SLOT] = 12; @@ -159,8 +148,6 @@ pckbc_isa_attach(parent, self, aux) if (pckbc_is_console(iot, IO_KBD)) { t = &pckbc_consdata; - ioh_d = t->t_ioh_d; - ioh_c = t->t_ioh_c; pckbc_console_attached = 1; /* t->t_cmdbyte was initialized by cnattach */ } else { @@ -186,11 +173,9 @@ pckbc_isa_attach(parent, self, aux) } void -pckbc_isa_intr_establish(sc, slot) - struct pckbc_softc *sc; - pckbc_slot_t slot; +pckbc_isa_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot) { - struct pckbc_isa_softc *isc = (void *) sc; + struct pckbc_isa_softc *isc = (void *)sc; void *rv; rv = isa_intr_establish(isc->sc_ic, isc->sc_irq[slot], IST_EDGE, |