#ifdef CONFIG_PNP
 #include <linux/pnp.h>
 
-static int i8042_pnp_kbd_registered;
+static bool i8042_pnp_kbd_registered;
 static unsigned int i8042_pnp_kbd_devices;
-static int i8042_pnp_aux_registered;
+static bool i8042_pnp_aux_registered;
 static unsigned int i8042_pnp_aux_devices;
 
 static int i8042_pnp_command_reg;
 static void i8042_pnp_exit(void)
 {
        if (i8042_pnp_kbd_registered) {
-               i8042_pnp_kbd_registered = 0;
+               i8042_pnp_kbd_registered = false;
                pnp_unregister_driver(&i8042_pnp_kbd_driver);
        }
 
        if (i8042_pnp_aux_registered) {
-               i8042_pnp_aux_registered = 0;
+               i8042_pnp_aux_registered = false;
                pnp_unregister_driver(&i8042_pnp_aux_driver);
        }
 }
 static int __init i8042_pnp_init(void)
 {
        char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
-       int pnp_data_busted = 0;
+       int pnp_data_busted = false;
        int err;
 
 #ifdef CONFIG_X86
        if (dmi_check_system(i8042_dmi_nopnp_table))
-               i8042_nopnp = 1;
+               i8042_nopnp = true;
 #endif
 
        if (i8042_nopnp) {
 
        err = pnp_register_driver(&i8042_pnp_kbd_driver);
        if (!err)
-               i8042_pnp_kbd_registered = 1;
+               i8042_pnp_kbd_registered = true;
 
        err = pnp_register_driver(&i8042_pnp_aux_driver);
        if (!err)
-               i8042_pnp_aux_registered = 1;
+               i8042_pnp_aux_registered = true;
 
        if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
                i8042_pnp_exit();
 
 #if defined(__ia64__)
        if (!i8042_pnp_kbd_devices)
-               i8042_nokbd = 1;
+               i8042_nokbd = true;
        if (!i8042_pnp_aux_devices)
-               i8042_noaux = 1;
+               i8042_noaux = true;
 #endif
 
        if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
                        "using default %#x\n",
                        i8042_pnp_data_reg, i8042_data_reg);
                i8042_pnp_data_reg = i8042_data_reg;
-               pnp_data_busted = 1;
+               pnp_data_busted = true;
        }
 
        if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) &&
                        "using default %#x\n",
                        i8042_pnp_command_reg, i8042_command_reg);
                i8042_pnp_command_reg = i8042_command_reg;
-               pnp_data_busted = 1;
+               pnp_data_busted = true;
        }
 
        if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
                        "PNP: PS/2 controller doesn't have KBD irq; "
                        "using default %d\n", i8042_kbd_irq);
                i8042_pnp_kbd_irq = i8042_kbd_irq;
-               pnp_data_busted = 1;
+               pnp_data_busted = true;
        }
 
        if (!i8042_noaux && !i8042_pnp_aux_irq) {
                                "PNP: PS/2 appears to have AUX port disabled, "
                                "if this is incorrect please boot with "
                                "i8042.nopnp\n");
-                       i8042_noaux = 1;
+                       i8042_noaux = true;
                } else {
                        printk(KERN_WARNING
                                "PNP: PS/2 controller doesn't have AUX irq; "
                return retval;
 
 #if defined(__ia64__)
-        i8042_reset = 1;
+        i8042_reset = true;
 #endif
 
 #ifdef CONFIG_X86
        if (dmi_check_system(i8042_dmi_reset_table))
-               i8042_reset = 1;
+               i8042_reset = true;
 
        if (dmi_check_system(i8042_dmi_noloop_table))
-               i8042_noloop = 1;
+               i8042_noloop = true;
 
        if (dmi_check_system(i8042_dmi_nomux_table))
-               i8042_nomux = 1;
+               i8042_nomux = true;
 
        if (dmi_check_system(i8042_dmi_dritek_table))
-               i8042_dritek = 1;
+               i8042_dritek = true;
 #endif /* CONFIG_X86 */
 
        return retval;
 
 MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver");
 MODULE_LICENSE("GPL");
 
-static unsigned int i8042_nokbd;
+static bool i8042_nokbd;
 module_param_named(nokbd, i8042_nokbd, bool, 0);
 MODULE_PARM_DESC(nokbd, "Do not probe or use KBD port.");
 
-static unsigned int i8042_noaux;
+static bool i8042_noaux;
 module_param_named(noaux, i8042_noaux, bool, 0);
 MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port.");
 
-static unsigned int i8042_nomux;
+static bool i8042_nomux;
 module_param_named(nomux, i8042_nomux, bool, 0);
 MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing conrtoller is present.");
 
-static unsigned int i8042_unlock;
+static bool i8042_unlock;
 module_param_named(unlock, i8042_unlock, bool, 0);
 MODULE_PARM_DESC(unlock, "Ignore keyboard lock.");
 
-static unsigned int i8042_reset;
+static bool i8042_reset;
 module_param_named(reset, i8042_reset, bool, 0);
 MODULE_PARM_DESC(reset, "Reset controller during init and cleanup.");
 
-static unsigned int i8042_direct;
+static bool i8042_direct;
 module_param_named(direct, i8042_direct, bool, 0);
 MODULE_PARM_DESC(direct, "Put keyboard port into non-translated mode.");
 
-static unsigned int i8042_dumbkbd;
+static bool i8042_dumbkbd;
 module_param_named(dumbkbd, i8042_dumbkbd, bool, 0);
 MODULE_PARM_DESC(dumbkbd, "Pretend that controller can only read data from keyboard");
 
-static unsigned int i8042_noloop;
+static bool i8042_noloop;
 module_param_named(noloop, i8042_noloop, bool, 0);
 MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port");
 
 MODULE_PARM_DESC(panicblink, "Frequency with which keyboard LEDs should blink when kernel panics");
 
 #ifdef CONFIG_X86
-static unsigned int i8042_dritek;
+static bool i8042_dritek;
 module_param_named(dritek, i8042_dritek, bool, 0);
 MODULE_PARM_DESC(dritek, "Force enable the Dritek keyboard extension");
 #endif
 
 #ifdef CONFIG_PNP
-static int i8042_nopnp;
+static bool i8042_nopnp;
 module_param_named(nopnp, i8042_nopnp, bool, 0);
 MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");
 #endif
 
 #define DEBUG
 #ifdef DEBUG
-static int i8042_debug;
+static bool i8042_debug;
 module_param_named(debug, i8042_debug, bool, 0600);
 MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
 #endif
 struct i8042_port {
        struct serio *serio;
        int irq;
-       unsigned char exists;
+       bool exists;
        signed char mux;
 };
 
 
 static unsigned char i8042_initial_ctr;
 static unsigned char i8042_ctr;
-static unsigned char i8042_mux_present;
-static unsigned char i8042_kbd_irq_registered;
-static unsigned char i8042_aux_irq_registered;
+static bool i8042_mux_present;
+static bool i8042_kbd_irq_registered;
+static bool i8042_aux_irq_registered;
 static unsigned char i8042_suppress_kbd_ack;
 static struct platform_device *i8042_platform_device;
 
 {
        struct i8042_port *port = serio->port_data;
 
-       port->exists = 1;
+       port->exists = true;
        mb();
        return 0;
 }
 {
        struct i8042_port *port = serio->port_data;
 
-       port->exists = 0;
+       port->exists = false;
 
        /*
         * We synchronize with both AUX and KBD IRQs because there is
 }
 
 /*
- * i8042_set_mux_mode checks whether the controller has an active
- * multiplexor and puts the chip into Multiplexed (1) or Legacy (0) mode.
+ * i8042_set_mux_mode checks whether the controller has an
+ * active multiplexor and puts the chip into Multiplexed (true)
+ * or Legacy (false) mode.
  */
 
-static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version)
+static int i8042_set_mux_mode(bool multiplex, unsigned char *mux_version)
 {
 
-       unsigned char param;
+       unsigned char param, val;
 /*
  * Get rid of bytes in the queue.
  */
  * mouse interface, the last should be version.
  */
 
-       param = 0xf0;
-       if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xf0)
+       param = val = 0xf0;
+       if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != val)
+               return -1;
+       param = val = multiplex ? 0x56 : 0xf6;
+       if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != val)
                return -1;
-       param = mode ? 0x56 : 0xf6;
-       if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != (mode ? 0x56 : 0xf6))
+       param = val = multiplex ? 0xa4 : 0xa5;
+       if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == val)
                return -1;
-       param = mode ? 0xa4 : 0xa5;
-       if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == (mode ? 0xa4 : 0xa5))
+
+/*
+ * Workaround for interference with USB Legacy emulation
+ * that causes a v10.12 MUX to be found.
+ */
+       if (param == 0xac)
                return -1;
 
        if (mux_version)
 {
        unsigned char mux_version;
 
-       if (i8042_set_mux_mode(1, &mux_version))
-               return -1;
-
-/*
- * Workaround for interference with USB Legacy emulation
- * that causes a v10.12 MUX to be found.
- */
-       if (mux_version == 0xAC)
+       if (i8042_set_mux_mode(true, &mux_version))
                return -1;
 
        printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n",
                return -EIO;
        }
 
-       i8042_mux_present = 1;
+       i8042_mux_present = true;
 
        return 0;
 }
  * The following is used to test AUX IRQ delivery.
  */
 static struct completion i8042_aux_irq_delivered __devinitdata;
-static int i8042_irq_being_tested __devinitdata;
+static bool i8042_irq_being_tested __devinitdata;
 
 static irqreturn_t __devinit i8042_aux_test_irq(int irq, void *dev_id)
 {
  * verifies success by readinng CTR. Used when testing for presence of AUX
  * port.
  */
-static int __devinit i8042_toggle_aux(int on)
+static int __devinit i8042_toggle_aux(bool on)
 {
        unsigned char param;
        int i;
 static int __devinit i8042_check_aux(void)
 {
        int retval = -1;
-       int irq_registered = 0;
-       int aux_loop_broken = 0;
+       bool irq_registered = false;
+       bool aux_loop_broken = false;
        unsigned long flags;
        unsigned char param;
 
  * mark it as broken
  */
                if (!retval)
-                       aux_loop_broken = 1;
+                       aux_loop_broken = true;
        }
 
 /*
  * Bit assignment test - filters out PS/2 i8042's in AT mode
  */
 
-       if (i8042_toggle_aux(0)) {
+       if (i8042_toggle_aux(false)) {
                printk(KERN_WARNING "Failed to disable AUX port, but continuing anyway... Is this a SiS?\n");
                printk(KERN_WARNING "If AUX port is really absent please use the 'i8042.noaux' option.\n");
        }
 
-       if (i8042_toggle_aux(1))
+       if (i8042_toggle_aux(true))
                return -1;
 
 /*
                        "i8042", i8042_platform_device))
                goto out;
 
-       irq_registered = 1;
+       irq_registered = true;
 
        if (i8042_enable_aux_port())
                goto out;
        spin_lock_irqsave(&i8042_lock, flags);
 
        init_completion(&i8042_aux_irq_delivered);
-       i8042_irq_being_tested = 1;
+       i8042_irq_being_tested = true;
 
        param = 0xa5;
        retval = __i8042_command(¶m, I8042_CMD_AUX_LOOP & 0xf0ff);
  */
 
        if (~i8042_ctr & I8042_CTR_XLATE)
-               i8042_direct = 1;
+               i8042_direct = true;
 
 /*
  * Set nontranslated mode for the kbd interface if requested by an option.
  */
 
        if (i8042_mux_present)
-               i8042_set_mux_mode(0, NULL);
+               i8042_set_mux_mode(false, NULL);
 
 /*
  * Reset the controller if requested.
 #endif
 
        if (i8042_mux_present) {
-               if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports())
+               if (i8042_set_mux_mode(true, NULL) || i8042_enable_mux_ports())
                        printk(KERN_WARNING
                                "i8042: failed to resume active multiplexor, "
                                "mouse won't work.\n");
        if (i8042_kbd_irq_registered)
                free_irq(I8042_KBD_IRQ, i8042_platform_device);
 
-       i8042_aux_irq_registered = i8042_kbd_irq_registered = 0;
+       i8042_aux_irq_registered = i8042_kbd_irq_registered = false;
 }
 
 static int __devinit i8042_setup_aux(void)
        if (aux_enable())
                goto err_free_irq;
 
-       i8042_aux_irq_registered = 1;
+       i8042_aux_irq_registered = true;
        return 0;
 
  err_free_irq:
        if (error)
                goto err_free_irq;
 
-       i8042_kbd_irq_registered = 1;
+       i8042_kbd_irq_registered = true;
        return 0;
 
  err_free_irq: