git: f63a2e288c92 - stable/13 - intrng: Use less confusing return value for intr_pic_add_handler
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 25 Jan 2022 01:40:18 UTC
The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f63a2e288c92e4b21ad6cde821b42d17ef307a84 commit f63a2e288c92e4b21ad6cde821b42d17ef307a84 Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2022-01-03 17:08:44 +0000 Commit: Jessica Clarke <jrtc27@FreeBSD.org> CommitDate: 2022-01-24 23:59:55 +0000 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 (cherry picked from commit a3e828c91d34e9e00f3f99516c1e5a349e49b1d4) --- sys/kern/subr_intr.c | 6 +++--- sys/sys/intr.h | 2 +- 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 *);