=================================================================== RCS file: /cvs/funnyos/kern/kern_irq.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- funnyos/kern/kern_irq.c 2007/11/04 23:18:46 1.2 +++ funnyos/kern/kern_irq.c 2007/12/16 23:24:59 1.3 @@ -1,5 +1,5 @@ /* - * $Id: kern_irq.c,v 1.2 2007/11/04 23:18:46 init Exp $ + * $Id: kern_irq.c,v 1.3 2007/12/16 23:24:59 nbrk Exp $ */ #include #include @@ -21,7 +21,7 @@ /* * Add interrupt vector to irqtable. */ - struct intr_vector *ivp; + struct intr_vector *ivp, *previvp; ivp = irqtable; @@ -43,14 +43,15 @@ } else { /* walk through the list */ - do { - /* check if this interrupt line already binded */ + while(ivp->iv_next != NULL) { if (ivp->iv_intrno == intrno) panic("failed to establish interrupt (intrno %d already set by other device)\n", intrno); - /* become next element */ ivp = ivp->iv_next; - } while(ivp != NULL); + } + /* found last entry */ + previvp = ivp; + ivp = ivp->iv_next; /* allocate space */ ivp = kmalloc(sizeof(struct intr_vector)); @@ -62,6 +63,9 @@ ivp->iv_device = device; ivp->iv_intrfunc = intrfunc; ivp->iv_next = NULL; + + /* link previous entry */ + previvp->iv_next = ivp; } }