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
This commit is contained in:
Jessica Clarke 2022-01-03 17:08:44 +00:00
parent 1a0a41b105
commit a3e828c91d
2 changed files with 4 additions and 4 deletions

View File

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

View File

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