1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Add a function to return the MD interrupt source cookie associated with

an interrupt event.  Use this in the x86 code to fixup the intrcnt names
when an interrupt handler is removed.
This commit is contained in:
John Baldwin 2006-12-12 19:20:19 +00:00
parent bc17acb2ad
commit c304531851
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=165125
4 changed files with 27 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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);