void vmeintr_disestablish(u_int vec, struct intrhand *ih) { struct intrhand *intr; intrhand_t *list; list = &vmeintr_handlers[vec]; evcount_detach(&ih->ih_count); SLIST_REMOVE(list, ih, intrhand, ih_link); if (!SLIST_EMPTY(list)) return; /* * Walk the interrupts table to check if this level needs * to be disabled. */ for (vec = 0; vec < NVMEINTR; vec++) { intr = SLIST_FIRST(&vmeintr_handlers[vec]); if (intr != NULL && intr->ih_ipl == ih->ih_ipl) break; } if (vec == NVMEINTR) intsrc_disable(INTSRC_VME(ih->ih_ipl)); }
/* * Unregister a C-bus interrupt service routine. */ int cbus_isrunlink(int (*func)(void *), int intlevel) { struct cbus_softc *sc = NULL; struct cbus_isr_t *ci; if (cbus_cd.cd_ndevs != 0) sc = cbus_cd.cd_devs[0]; if (sc == NULL) panic("cbus_isrunlink: can't find cbus_softc"); #ifdef DIAGNOSTIC if (intlevel < 0 || intlevel >= NCBUSISR) { printf("cbus_isrunlink: bad INT level %d\n", intlevel); return -1; } #endif ci = &sc->cbus_isr[intlevel]; if (ci->isr_func == NULL) { printf("cbus_isrunlink: isr not assigned on INT%d\n", intlevel); return -1; } /* reset the entry */ ci->isr_func = NULL; ci->isr_arg = NULL; ci->isr_intlevel = ci->isr_ipl = -1; evcount_detach(&ci->isr_count); sc->registered &= ~(1 << (6 - intlevel)); /* clear interrupt flags */ *cbus_isreg = (u_int8_t)(6 - intlevel); #ifdef CBUS_DEBUG printf("cbus_isrunlink: sc->registered = 0x%02x\n", sc->registered); #endif return 0; }
void omgpio_intr_disestablish(void *cookie) { int psw; struct intrhand *ih = cookie; struct omgpio_softc *sc = omgpio_cd.cd_devs[GPIO_PIN_TO_INST(ih->ih_gpio)]; int gpio = ih->ih_gpio; psw = disable_interrupts(I32_bit); ih = sc->sc_handlers[GPIO_PIN_TO_OFFSET(gpio)]; sc->sc_handlers[GPIO_PIN_TO_OFFSET(gpio)] = NULL; evcount_detach(&ih->ih_count); free(ih, M_DEVBUF); omgpio_intr_level(gpio, IST_NONE); omgpio_intr_mask(gpio); omgpio_clear_intr(gpio); /* Just in case */ omgpio_recalc_interrupts(sc); restore_interrupts(psw); }