Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic pckbc(4): Simplify the (disabled) logic to check ...



details:   https://anonhg.NetBSD.org/src/rev/27f8f8cbf23a
branches:  trunk
changeset: 372152:27f8f8cbf23a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Oct 28 23:44:38 2022 +0000

description:
pckbc(4): Simplify the (disabled) logic to check keyboard port.

No functional change intended -- just reduces code duplication (and
fixes wrong-number-of-arguments in #if 0 logic).

diffstat:

 sys/dev/ic/pckbc.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (53 lines):

diff -r 5a0f82ac2047 -r 27f8f8cbf23a sys/dev/ic/pckbc.c
--- a/sys/dev/ic/pckbc.c        Fri Oct 28 23:40:37 2022 +0000
+++ b/sys/dev/ic/pckbc.c        Fri Oct 28 23:44:38 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc.c,v 1.63 2022/10/28 23:40:37 riastradh Exp $ */
+/* $NetBSD: pckbc.c,v 1.64 2022/10/28 23:44:38 riastradh Exp $ */
 
 /*
  * Copyright (c) 2004 Ben Harris.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.63 2022/10/28 23:40:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.64 2022/10/28 23:44:38 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -311,27 +311,23 @@
         */
        if (!pckbc_send_cmd(iot, ioh_c, KBC_KBDTEST))
                return;
-       res = pckbc_poll_data1(t, PCKBC_KBD_SLOT, 0);
+       res = pckbc_poll_data1(t, PCKBC_KBD_SLOT);
 
        /*
         * Normally, we should get a "0" here.
         * But there are keyboard controllers behaving differently.
         */
-       if (res == 0 || res == 0xfa || res == 0x01 || res == 0xab) {
-#ifdef PCKBCDEBUG
-               if (res != 0)
-                       printf("pckbc: returned %x on kbd slot test\n", res);
-#endif
-               if (pckbc_attach_slot(sc, PCKBC_KBD_SLOT))
-                       cmdbits |= KC8_KENABLE;
-       } else {
+       if (!(res == 0 || res == 0xfa || res == 0x01 || res == 0xab)) {
                printf("pckbc: kbd port test: %x\n", res);
                return;
        }
-#else
+#ifdef PCKBCDEBUG
+       if (res != 0)
+               printf("pckbc: returned %x on kbd slot test\n", res);
+#endif
+#endif /* 0 */
        if (pckbc_attach_slot(sc, PCKBC_KBD_SLOT))
                cmdbits |= KC8_KENABLE;
-#endif /* 0 */
 
        /*
         * Check aux port ok.



Home | Main Index | Thread Index | Old Index