diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-03-16 16:35:50 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-03-16 16:35:50 +0000 |
commit | 60994cdb738e0d241981deaa4b6df2fed47fe2ce (patch) | |
tree | 7e1d68046313a7019533b548deaff048f8e32a29 /sys/arch/octeon | |
parent | 0e38ecf7188766e1facdfc19c1a71ebf43832803 (diff) |
Unify the top-level structure of interrupt handles. This helps
when implementing interrupt-specific logic for intr_barrier(9).
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r-- | sys/arch/octeon/dev/octeon_intr.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/sys/arch/octeon/dev/octeon_intr.c b/sys/arch/octeon/dev/octeon_intr.c index b9904bf0d77..22a1b3bb2ae 100644 --- a/sys/arch/octeon/dev/octeon_intr.c +++ b/sys/arch/octeon/dev/octeon_intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: octeon_intr.c,v 1.22 2017/06/18 13:58:44 visa Exp $ */ +/* $OpenBSD: octeon_intr.c,v 1.23 2019/03/16 16:35:49 visa Exp $ */ /* * Copyright (c) 2000-2004 Opsycon AB (www.opsycon.se) @@ -88,7 +88,24 @@ void * octeon_intr_establish(int irq, int level, int (*ih_fun)(void *), void *ih_arg, const char *ih_what) { - return octeon_ic->ic_establish(irq, level, ih_fun, ih_arg, ih_what); + struct intr_controller *ic = octeon_ic; + struct intr_handle *ih; + void *handler; + + ih = malloc(sizeof(*ih), M_DEVBUF, M_NOWAIT); + if (ih == NULL) + return NULL; + + handler = ic->ic_establish(irq, level, ih_fun, ih_arg, ih_what); + if (handler == NULL) { + free(ih, M_DEVBUF, sizeof(*ih)); + return NULL; + } + + ih->ih_ic = ic; + ih->ih_ih = handler; + + return ih; } void * @@ -132,18 +149,13 @@ octeon_intr_establish_fdt_idx(int node, int idx, int level, ih->ih_ic = ic; ih->ih_ih = handler; + return ih; } void octeon_intr_disestablish(void *cookie) { - octeon_ic->ic_disestablish(cookie); -} - -void -octeon_intr_disestablish_fdt(void *cookie) -{ struct intr_handle *ih = cookie; struct intr_controller *ic = ih->ih_ic; @@ -151,6 +163,12 @@ octeon_intr_disestablish_fdt(void *cookie) free(ih, M_DEVBUF, sizeof(*ih)); } +void +octeon_intr_disestablish_fdt(void *cookie) +{ + octeon_intr_disestablish(cookie); +} + #ifdef MULTIPROCESSOR /* * Inter-processor interrupt control logic. |