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:
parent
d8fed0f0f2
commit
cbd0150530
@ -389,17 +389,29 @@ isa_teardown_intr(device_t dev, device_t child,
|
|||||||
struct resource *irq, void *cookie)
|
struct resource *irq, void *cookie)
|
||||||
{
|
{
|
||||||
struct isa_intr *ii = 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);
|
mtx_lock(&ithread->it_lock);
|
||||||
isa_intr_disable(irq->r_start);
|
TAILQ_FOREACH(ih, &ithread->it_handlers, ih_next)
|
||||||
mtx_unlock_spin(&icu_lock);
|
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);
|
alpha_teardown_intr(ii->ih);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user