Index: kernel/generic/src/ddi/irq.c
===================================================================
--- kernel/generic/src/ddi/irq.c	(revision 4874c2dc3da3748951cb71f24805c35b88106d0f)
+++ kernel/generic/src/ddi/irq.c	(revision 95b355086cd805dc6f9cc96f44fa2ef92cecd8b5)
@@ -146,8 +146,10 @@
 	irq->handler = NULL;
 	irq->arg = NULL;
+	irq->notif_cfg.notify = false;
 	irq->notif_cfg.answerbox = NULL;
 	irq->notif_cfg.code = NULL;
 	irq->notif_cfg.method = 0;
 	irq->notif_cfg.counter = 0;
+	link_initialize(&irq->notif_cfg.link);
 }
 
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision 4874c2dc3da3748951cb71f24805c35b88106d0f)
+++ kernel/generic/src/ipc/ipc.c	(revision 95b355086cd805dc6f9cc96f44fa2ef92cecd8b5)
@@ -109,4 +109,5 @@
 	list_initialize(&box->answers);
 	list_initialize(&box->irq_notifs);
+	list_initialize(&box->irq_head);
 	box->task = TASK;
 }
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision 4874c2dc3da3748951cb71f24805c35b88106d0f)
+++ kernel/generic/src/ipc/irq.c	(revision 95b355086cd805dc6f9cc96f44fa2ef92cecd8b5)
@@ -177,4 +177,5 @@
 	if (irq) {
 		if (irq->notif_cfg.answerbox == box) {
+			code_free(irq->notif_cfg.code);
 			irq->notif_cfg.notify = false;
 			irq->notif_cfg.answerbox = NULL;
@@ -182,5 +183,9 @@
 			irq->notif_cfg.method = 0;
 			irq->notif_cfg.counter = 0;
-			code_free(irq->notif_cfg.code);
+
+			spinlock_lock(&box->irq_lock);
+			list_remove(&irq->notif_cfg.link);
+			spinlock_unlock(&box->irq_lock);
+			
 			spinlock_unlock(&irq->lock);
 		}
@@ -199,6 +204,5 @@
  * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
  */
-int
-ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode)
+int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode)
 {
 	ipl_t ipl;
@@ -233,4 +237,9 @@
 	irq->notif_cfg.code = code;
 	irq->notif_cfg.counter = 0;
+
+	spinlock_lock(&box->irq_lock);
+	list_append(&irq->notif_cfg.link, &box->irq_head);
+	spinlock_unlock(&box->irq_lock);
+
 	spinlock_unlock(&irq->lock);
 	interrupts_restore(ipl);
@@ -311,9 +320,52 @@
 /** Disconnect all IRQ notifications from an answerbox.
  *
+ * This function is effective because the answerbox contains
+ * list of all irq_t structures that are registered to
+ * send notifications to it.
+ *
  * @param box Answerbox for which we want to carry out the cleanup.
  */
 void ipc_irq_cleanup(answerbox_t *box)
 {
-	/* TODO */
+	ipl_t ipl;
+	
+loop:
+	ipl = interrupts_disable();
+	spinlock_lock(&box->irq_lock);
+	
+	while (box->irq_head.next != &box->irq_head) {
+		link_t *cur = box->irq_head.next;
+		irq_t *irq;
+		
+		irq = list_get_instance(cur, irq_t, notif_cfg.link);
+		if (!spinlock_trylock(&irq->lock)) {
+			/*
+			 * Avoid deadlock by trying again.
+			 */
+			spinlock_unlock(&box->irq_lock);
+			interrupts_restore(ipl);
+			goto loop;
+		}
+		
+		ASSERT(irq->notif_cfg.answerbox == box);
+		
+		list_remove(&irq->notif_cfg.link);
+		
+		/*
+		 * Don't forget to free any top-half pseudocode.
+		 */
+		code_free(irq->notif_cfg.code);
+		
+		irq->notif_cfg.notify = false;
+		irq->notif_cfg.answerbox = NULL;
+		irq->notif_cfg.code = NULL;
+		irq->notif_cfg.method = 0;
+		irq->notif_cfg.counter = 0;
+
+		spinlock_unlock(&irq->lock);
+	}
+	
+	spinlock_unlock(&box->irq_lock);
+	interrupts_restore(ipl);
 }
 
