diff options
author | Alexandr Shadchin <shadchin@cvs.openbsd.org> | 2012-08-10 17:49:32 +0000 |
---|---|---|
committer | Alexandr Shadchin <shadchin@cvs.openbsd.org> | 2012-08-10 17:49:32 +0000 |
commit | 0cee9cb15da335548bc0f586fa041d1627c2b85b (patch) | |
tree | 0a3add3489c4db2e1d865fd1502e3cac2694a85b /sys/dev/ic | |
parent | de3317878fe731812fe3a89da7aaa2ef20d57f76 (diff) |
simplify pckbc_xt_translation()
* call only for set translation on (once in /sys/dev/pckbd.c)
therefore we can delete unused code.
* change behavior (more standard) - return zero on success
ok miod@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/pckbc.c | 34 | ||||
-rw-r--r-- | sys/dev/ic/pckbcvar.h | 4 |
2 files changed, 13 insertions, 25 deletions
diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index 5f388e42b01..49d01d6b4b1 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbc.c,v 1.29 2012/02/02 21:40:20 deraadt Exp $ */ +/* $OpenBSD: pckbc.c,v 1.30 2012/08/10 17:49:31 shadchin Exp $ */ /* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */ /* @@ -482,40 +482,28 @@ pckbc_poll_data(pckbc_tag_t self, pckbc_slot_t slot) } /* - * switch scancode translation on / off - * return nonzero on success + * set scancode translation on */ int -pckbc_xt_translation(pckbc_tag_t self, pckbc_slot_t slot, int on) +pckbc_xt_translation(pckbc_tag_t self) { struct pckbc_internal *t = self; - int ison; - if (ISSET(t->t_flags, PCKBC_CANT_TRANSLATE) || - slot != PCKBC_KBD_SLOT) { - /* translation only for kbd slot */ - if (on) - return (0); - else - return (1); - } + if (ISSET(t->t_flags, PCKBC_CANT_TRANSLATE)) + return (-1); - ison = t->t_cmdbyte & KC8_TRANS; - if ((on && ison) || (!on && !ison)) - return (1); + if (t->t_cmdbyte & KC8_TRANS) + return (0); - t->t_cmdbyte ^= KC8_TRANS; + t->t_cmdbyte |= KC8_TRANS; if (!pckbc_put8042cmd(t)) - return (0); + return (-1); /* read back to be sure */ if (!pckbc_get8042cmd(t)) - return (0); + return (-1); - ison = t->t_cmdbyte & KC8_TRANS; - if ((on && ison) || (!on && !ison)) - return (1); - return (0); + return (t->t_cmdbyte & KC8_TRANS) ? (0) : (-1); } static struct pckbc_portcmd { diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index 612e1432edf..cfb06718875 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbcvar.h,v 1.11 2012/02/02 21:40:20 deraadt Exp $ */ +/* $OpenBSD: pckbcvar.h,v 1.12 2012/08/10 17:49:31 shadchin Exp $ */ /* $NetBSD: pckbcvar.h,v 1.4 2000/06/09 04:58:35 soda Exp $ */ /* @@ -102,7 +102,7 @@ int pckbc_poll_data(pckbc_tag_t, pckbc_slot_t); int pckbc_poll_data1(bus_space_tag_t, bus_space_handle_t, bus_space_handle_t, pckbc_slot_t, int); void pckbc_set_poll(pckbc_tag_t, pckbc_slot_t, int); -int pckbc_xt_translation(pckbc_tag_t, pckbc_slot_t, int); +int pckbc_xt_translation(pckbc_tag_t); void pckbc_slot_enable(pckbc_tag_t, pckbc_slot_t, int); void pckbc_attach(struct pckbc_softc *, int); |