diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -527,11 +527,10 @@ } int -intr_event_destroy(struct intr_event *ie) +intr_event_destroy_(struct intr_event *ie) { - if (ie == NULL) - return (EINVAL); + MPASS(ie != NULL); mtx_lock(&event_lock); mtx_lock(&ie->ie_lock); @@ -550,6 +549,16 @@ return (0); } +int +intr_event_destroy(struct intr_event *ie) +{ + + if (ie == NULL) + return (EINVAL); + + return (intr_event_destroy_(ie)); +} + static struct intr_thread * ithread_create(const char *name) { @@ -1342,7 +1351,7 @@ * o EINVAL: stray interrupt. */ int -intr_event_handle(struct intr_event *ie, struct trapframe *frame) +intr_event_handle_(struct intr_event *ie, struct trapframe *frame) { struct intr_handler *ih; struct trapframe *oldframe; @@ -1357,8 +1366,10 @@ intr_prof_stack_use(td, frame); #endif - /* An interrupt with no event or handlers is a stray interrupt. */ - if (ie == NULL || CK_SLIST_EMPTY(&ie->ie_handlers)) + MPASS(ie != NULL); + + /* An interrupt with no handlers is a stray interrupt. */ + if (CK_SLIST_EMPTY(&ie->ie_handlers)) return (EINVAL); /* @@ -1459,6 +1470,17 @@ return (0); } +int +intr_event_handle(struct intr_event *ie, struct trapframe *frame) +{ + + /* An interrupt with no event is a stray interrupt. */ + if (ie == NULL) + return (EINVAL); + + return (intr_event_handle_(ie, frame)); +} + #ifdef DDB /* * Dump details about an interrupt handler diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -405,7 +405,7 @@ } else #endif if (isrc->isrc_event != NULL) { - if (intr_event_handle(isrc->isrc_event, tf) == 0) + if (intr_event_handle_(isrc->isrc_event, tf) == 0) return (0); } diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -182,7 +182,9 @@ __printflike(9, 10); int intr_event_describe_handler(struct intr_event *ie, void *cookie, const char *descr); +int intr_event_destroy_(struct intr_event *ie) __result_use_check; int intr_event_destroy(struct intr_event *ie); +int intr_event_handle_(struct intr_event *ie, struct trapframe *frame); int intr_event_handle(struct intr_event *ie, struct trapframe *frame); int intr_event_remove_handler(void *cookie); int intr_event_suspend_handler(void *cookie); diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -321,6 +321,8 @@ struct intr_event *ie; int vector; + MPASS(isrc != NULL); + /* * We count software interrupts when we process them. The * code here follows previous practice, but there's an @@ -332,6 +334,8 @@ ie = isrc->is_event; + MPASS(ie != NULL); + /* * XXX: We assume that IRQ 0 is only used for the ISA timer * device (clk). @@ -344,7 +348,7 @@ * For stray interrupts, mask and EOI the source, bump the * stray count, and log the condition. */ - if (intr_event_handle(ie, frame) != 0) { + if (intr_event_handle_(ie, frame) != 0) { isrc->is_pic->pic_disable_source(isrc, PIC_EOI); (*isrc->is_straycount)++; if (*isrc->is_straycount < INTR_STRAY_LOG_MAX)