Enable loadable modules to be unloaded on alphas with shared isa

interrupts  by only disabling the interrupt in hardware if
the handler being removed is the only handler.
This commit is contained in:
Andrew Gallatin 2003-04-10 20:32:29 +00:00
parent d8fed0f0f2
commit cbd0150530
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113344

View File

@ -389,17 +389,29 @@ isa_teardown_intr(device_t dev, device_t child,
struct resource *irq, void *cookie)
{
struct isa_intr *ii = cookie;
struct intrhand *ih, *handler = (struct intrhand *)ii->ih;
struct ithd *ithread = handler->ih_ithread;
int num_handlers = 0;
mtx_lock_spin(&icu_lock);
isa_intr_disable(irq->r_start);
mtx_unlock_spin(&icu_lock);
mtx_lock(&ithread->it_lock);
TAILQ_FOREACH(ih, &ithread->it_handlers, ih_next)
num_handlers++;
mtx_unlock(&ithread->it_lock);
/* only disable the interrupt in hardware if there are no
other handlers sharing it */
if (num_handlers == 1) {
mtx_lock_spin(&icu_lock);
isa_intr_disable(irq->r_start);
mtx_unlock_spin(&icu_lock);
if (platform.isa_teardown_intr) {
platform.isa_teardown_intr(dev, child, irq,
cookie);
return 0;
}
if (platform.isa_teardown_intr) {
platform.isa_teardown_intr(dev, child, irq, cookie);
return 0;
}
alpha_teardown_intr(ii->ih);
return 0;
}