diff --git a/sys/amd64/amd64/intr_machdep.c b/sys/amd64/amd64/intr_machdep.c index da6ca17e83a6..a3db90d1126e 100644 --- a/sys/amd64/amd64/intr_machdep.c +++ b/sys/amd64/amd64/intr_machdep.c @@ -190,13 +190,13 @@ intr_add_handler(const char *name, int vector, driver_intr_t handler, int intr_remove_handler(void *cookie) { + struct intsrc *isrc; int error; + isrc = intr_handler_source(cookie); error = intr_event_remove_handler(cookie); -#ifdef XXX if (error == 0) - intrcnt_updatename(/* XXX */); -#endif + intrcnt_updatename(isrc); return (error); } diff --git a/sys/i386/i386/intr_machdep.c b/sys/i386/i386/intr_machdep.c index ddb194f73ca8..e6e21bf32f66 100644 --- a/sys/i386/i386/intr_machdep.c +++ b/sys/i386/i386/intr_machdep.c @@ -181,13 +181,13 @@ intr_add_handler(const char *name, int vector, driver_intr_t handler, int intr_remove_handler(void *cookie) { + struct intsrc *isrc; int error; + isrc = intr_handler_source(cookie); error = intr_event_remove_handler(cookie); -#ifdef XXX if (error == 0) - intrcnt_updatename(/* XXX */); -#endif + intrcnt_updatename(isrc); return (error); } diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 8d1dbe8d3ac5..9cab3bfff3a6 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -396,6 +396,26 @@ intr_event_add_handler(struct intr_event *ie, const char *name, return (0); } +/* + * Return the ie_source field from the intr_event an intr_handler is + * associated with. + */ +void * +intr_handler_source(void *cookie) +{ + struct intr_handler *ih; + struct intr_event *ie; + + ih = (struct intr_handler *)cookie; + if (ih == NULL) + return (NULL); + ie = ih->ih_event; + KASSERT(ie != NULL, + ("interrupt handler \"%s\" has a NULL interrupt event", + ih->ih_name)); + return (ie->ie_source); +} + int intr_event_remove_handler(void *cookie) { diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index 285670365391..0e73976819dc 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -121,6 +121,7 @@ int intr_event_create(struct intr_event **event, void *source, int intr_event_destroy(struct intr_event *ie); int intr_event_remove_handler(void *cookie); int intr_event_schedule_thread(struct intr_event *ie); +void *intr_handler_source(void *cookie); int swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, void *arg, int pri, enum intr_type flags, void **cookiep);