Simplify the flow when getting/setting an isrc
Rather than unlocking and returning we can just perform the needed action only when the interrupt source is valid and reuse the unlock in both the valid irq and invalid irq cases. Sponsored by: Innovate UK
This commit is contained in:
parent
6d76adbb6d
commit
ecc8ccb441
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362834
@ -1517,13 +1517,12 @@ intr_map_get_isrc(u_int res_id)
|
|||||||
{
|
{
|
||||||
struct intr_irqsrc *isrc;
|
struct intr_irqsrc *isrc;
|
||||||
|
|
||||||
|
isrc = NULL;
|
||||||
mtx_lock(&irq_map_lock);
|
mtx_lock(&irq_map_lock);
|
||||||
if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) {
|
if (res_id < irq_map_count && irq_map[res_id] != NULL)
|
||||||
mtx_unlock(&irq_map_lock);
|
isrc = irq_map[res_id]->isrc;
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
isrc = irq_map[res_id]->isrc;
|
|
||||||
mtx_unlock(&irq_map_lock);
|
mtx_unlock(&irq_map_lock);
|
||||||
|
|
||||||
return (isrc);
|
return (isrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1532,11 +1531,8 @@ intr_map_set_isrc(u_int res_id, struct intr_irqsrc *isrc)
|
|||||||
{
|
{
|
||||||
|
|
||||||
mtx_lock(&irq_map_lock);
|
mtx_lock(&irq_map_lock);
|
||||||
if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) {
|
if (res_id < irq_map_count && irq_map[res_id] != NULL)
|
||||||
mtx_unlock(&irq_map_lock);
|
irq_map[res_id]->isrc = isrc;
|
||||||
return;
|
|
||||||
}
|
|
||||||
irq_map[res_id]->isrc = isrc;
|
|
||||||
mtx_unlock(&irq_map_lock);
|
mtx_unlock(&irq_map_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user