Small change to remove a bug in removal.
This in association with Michael N in IRC. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@350 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+13
-16
@@ -63,8 +63,6 @@ long install_interrupt_handler(long vector, interrupt_handler handler,
|
|||||||
struct io_handler *io = NULL;
|
struct io_handler *io = NULL;
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
dprintf("install_interrupt_handler: vector %ld\n", vector);
|
|
||||||
|
|
||||||
/* find the chain of handlers for this irq.
|
/* find the chain of handlers for this irq.
|
||||||
* NB there can be multiple handlers for the same IRQ, especially for
|
* NB there can be multiple handlers for the same IRQ, especially for
|
||||||
* PCI drivers. Where we have multiple handlers we will call each in turn
|
* PCI drivers. Where we have multiple handlers we will call each in turn
|
||||||
@@ -101,9 +99,7 @@ long install_io_interrupt_handler(long irq, interrupt_handler handler,
|
|||||||
void* data, ulong flags)
|
void* data, ulong flags)
|
||||||
{
|
{
|
||||||
long vector = irq + 0x20;
|
long vector = irq + 0x20;
|
||||||
long rv;
|
long rv = install_interrupt_handler(vector, handler, data);
|
||||||
dprintf("install_io_interrupt_handler: irq %ld\n", irq);
|
|
||||||
rv = install_interrupt_handler(vector, handler, data);
|
|
||||||
|
|
||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
return rv;
|
return rv;
|
||||||
@@ -125,7 +121,8 @@ long remove_interrupt_handler(long vector, interrupt_handler handler,
|
|||||||
void* data)
|
void* data)
|
||||||
{
|
{
|
||||||
struct io_handler *io = NULL;
|
struct io_handler *io = NULL;
|
||||||
|
long rv = EINVAL;
|
||||||
|
|
||||||
/* lock the structures down so it is not modified while we search */
|
/* lock the structures down so it is not modified while we search */
|
||||||
int state = int_disable_interrupts();
|
int state = int_disable_interrupts();
|
||||||
acquire_spinlock(&io_vectors[vector].vector_lock);
|
acquire_spinlock(&io_vectors[vector].vector_lock);
|
||||||
@@ -134,25 +131,25 @@ long remove_interrupt_handler(long vector, interrupt_handler handler,
|
|||||||
* We go forward through the list but this means we start with the
|
* We go forward through the list but this means we start with the
|
||||||
* most recently added handlers.
|
* most recently added handlers.
|
||||||
*/
|
*/
|
||||||
io = io_vectors[vector].handler_list.next;
|
|
||||||
for (io = io_vectors[vector].handler_list.next;
|
for (io = io_vectors[vector].handler_list.next;
|
||||||
io != &io_vectors[vector].handler_list;
|
io != &io_vectors[vector].handler_list;
|
||||||
io = io->next) {
|
io = io->next) {
|
||||||
/* we have to match both function and data */
|
/* we have to match both function and data */
|
||||||
if (io->func == handler && io->data == data)
|
if (io->func == handler && io->data == data) {
|
||||||
break;
|
remque(io);
|
||||||
|
kfree(io);
|
||||||
|
rv = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (io) {
|
/* to finish we need to release our locks and return
|
||||||
remque(io);
|
* the value rv
|
||||||
kfree(io);
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
// release our lock as we're done with the vector
|
|
||||||
release_spinlock(&io_vectors[vector].vector_lock);
|
release_spinlock(&io_vectors[vector].vector_lock);
|
||||||
int_restore_interrupts(state);
|
int_restore_interrupts(state);
|
||||||
|
|
||||||
return (io != NULL) ? 0 : EINVAL;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove_io_interrupt_handler
|
/* remove_io_interrupt_handler
|
||||||
|
|||||||
Reference in New Issue
Block a user