Index: kernel/genarch/src/kbd/i8042.c
===================================================================
--- kernel/genarch/src/kbd/i8042.c	(revision b3f8fb771f871e7f2bb35ce9339717639e8f86d6)
+++ kernel/genarch/src/kbd/i8042.c	(revision e8a0b90b4a2726b532a39fb80b80662f5bed01e9)
@@ -75,6 +75,6 @@
 
 #define i8042_BUFFER_FULL_MASK	0x01
-#define i8042_WAIT_MASK 	0x02
-#define i8042_MOUSE_DATA        0x20
+#define i8042_WAIT_MASK			0x02
+#define i8042_MOUSE_DATA		0x20
 
 static void i8042_suspend(chardev_t *);
@@ -91,21 +91,8 @@
 static irq_t i8042_mouse_irq;
 
-/** Wait until the controller reads its data. */
-static void i8042_wait(void) {
-	while (i8042_status_read() & i8042_WAIT_MASK) {
-		/* wait */
-	}
-}
-
 void i8042_grab(void)
 {
 	ipl_t ipl = interrupts_disable();
 	
-	i8042_wait();
-	i8042_command_write(i8042_SET_COMMAND);
-	i8042_wait();
-	i8042_data_write(i8042_COMMAND);
-	i8042_wait();
-
 	spinlock_lock(&i8042_kbd_irq.lock);
 	i8042_kbd_irq.notif_cfg.notify = false;
@@ -141,30 +128,24 @@
 }
 
-static void i8042_kbd_irq_handler(irq_t *irq, void *arg, ...)
+static void i8042_irq_handler(irq_t *irq, void *arg, ...)
 {
 	if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
 		ipc_irq_send_notif(irq);
 	else {
-		uint8_t x;
+		uint8_t data;
 		uint8_t status;
 		
 		while (((status = i8042_status_read()) & i8042_BUFFER_FULL_MASK)) {
-			x = i8042_data_read();
+			data = i8042_data_read();
 			
 			if ((status & i8042_MOUSE_DATA))
 				continue;
-			
-			if (x & KEY_RELEASE)
-				key_released(x ^ KEY_RELEASE);
+
+			if (data & KEY_RELEASE)
+				key_released(data ^ KEY_RELEASE);
 			else
-				key_pressed(x);
+				key_pressed(data);
 		}
 	}
-}
-
-static void i8042_mouse_irq_handler(irq_t *irq, void *arg, ...)
-{
-	if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
-		ipc_irq_send_notif(irq);
 }
 
@@ -179,5 +160,5 @@
 	i8042_kbd_irq.inr = kbd_inr;
 	i8042_kbd_irq.claim = i8042_claim;
-	i8042_kbd_irq.handler = i8042_kbd_irq_handler;
+	i8042_kbd_irq.handler = i8042_irq_handler;
 	irq_register(&i8042_kbd_irq);
 	
@@ -186,5 +167,5 @@
 	i8042_mouse_irq.inr = mouse_inr;
 	i8042_mouse_irq.claim = i8042_claim;
-	i8042_mouse_irq.handler = i8042_mouse_irq_handler;
+	i8042_mouse_irq.handler = i8042_irq_handler;
 	irq_register(&i8042_mouse_irq);
 	
