aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@FreeBSD.org>2022-01-03 17:08:44 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2022-01-03 17:08:44 +0000
commita3e828c91d34e9e00f3f99516c1e5a349e49b1d4 (patch)
tree1e1d996afe0eb74b7ae7e4e37b4e1c1e02bbe500
parent1a0a41b10566e75e77e7efbc8475622b6a37ffbf (diff)
downloadsrc-a3e828c91d34e9e00f3f99516c1e5a349e49b1d4.tar.gz
src-a3e828c91d34e9e00f3f99516c1e5a349e49b1d4.zip
intrng: Use less confusing return value for intr_pic_add_handler
Currently intr_pic_add_handler either returns the PIC you gave it (which is useless and risks causing confusion about whether it's creating another PIC) or, on error, NULL. Instead, convert it to return an int error code as one would expect. Note that the only consumer of this API, arm64's gicv3_its, does not use the return value, so no uses need updating to work with the revised API. Reviewed by: markj, mmel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33341
-rw-r--r--sys/kern/subr_intr.c6
-rw-r--r--sys/sys/intr.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c
index 04636f09c5a1..16306c78cbd9 100644
--- a/sys/kern/subr_intr.c
+++ b/sys/kern/subr_intr.c
@@ -898,7 +898,7 @@ intr_pic_claim_root(device_t dev, intptr_t xref, intr_irq_filter_t *filter,
/*
* Add a handler to manage a sub range of a parents interrupts.
*/
-struct intr_pic *
+int
intr_pic_add_handler(device_t parent, struct intr_pic *pic,
intr_child_irq_filter_t *filter, void *arg, uintptr_t start,
uintptr_t length)
@@ -912,7 +912,7 @@ intr_pic_add_handler(device_t parent, struct intr_pic *pic,
/* Find the parent PIC */
parent_pic = pic_lookup(parent, 0, FLAG_PIC);
if (parent_pic == NULL)
- return (NULL);
+ return (ENXIO);
newchild = malloc(sizeof(*newchild), M_INTRNG, M_WAITOK | M_ZERO);
newchild->pc_pic = pic;
@@ -931,7 +931,7 @@ intr_pic_add_handler(device_t parent, struct intr_pic *pic,
SLIST_INSERT_HEAD(&parent_pic->pic_children, newchild, pc_next);
mtx_unlock_spin(&parent_pic->pic_child_lock);
- return (pic);
+ return (0);
}
static int
diff --git a/sys/sys/intr.h b/sys/sys/intr.h
index b373a6f23bf0..8c51fe7cb504 100644
--- a/sys/sys/intr.h
+++ b/sys/sys/intr.h
@@ -113,7 +113,7 @@ u_int intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask);
struct intr_pic *intr_pic_register(device_t, intptr_t);
int intr_pic_deregister(device_t, intptr_t);
int intr_pic_claim_root(device_t, intptr_t, intr_irq_filter_t *, void *, u_int);
-struct intr_pic *intr_pic_add_handler(device_t, struct intr_pic *,
+int intr_pic_add_handler(device_t, struct intr_pic *,
intr_child_irq_filter_t *, void *, uintptr_t, uintptr_t);
bool intr_is_per_cpu(struct resource *);