Page MenuHomeFreeBSD

D29310.id.diff
No OneTemporary

D29310.id.diff

Index: sys/kern/subr_intr.c
===================================================================
--- sys/kern/subr_intr.c
+++ sys/kern/subr_intr.c
@@ -401,33 +401,21 @@
static inline int
isrc_alloc_irq(struct intr_irqsrc *isrc)
{
- u_int maxirqs, irq;
-
mtx_assert(&isrc_table_lock, MA_OWNED);
- maxirqs = intr_nirq;
- if (irq_next_free >= maxirqs)
- return (ENOSPC);
-
- for (irq = irq_next_free; irq < maxirqs; irq++) {
- if (irq_sources[irq] == NULL)
- goto found;
- }
- for (irq = 0; irq < irq_next_free; irq++) {
- if (irq_sources[irq] == NULL)
+ while (irq_next_free < intr_nirq) {
+ if (irq_sources[irq_next_free] == NULL)
goto found;
+ ++irq_next_free;
}
- irq_next_free = maxirqs;
return (ENOSPC);
found:
- isrc->isrc_irq = irq;
- irq_sources[irq] = isrc;
+ isrc->isrc_irq = irq_next_free;
+ irq_sources[irq_next_free] = isrc;
- irq_next_free = irq + 1;
- if (irq_next_free >= maxirqs)
- irq_next_free = 0;
+ ++irq_next_free;
return (0);
}
@@ -445,6 +433,10 @@
if (irq_sources[isrc->isrc_irq] != isrc)
return (EINVAL);
+ /* Keep irq_next_free pointing at lowest available interrupt. */
+ if (isrc->isrc_irq < irq_next_free)
+ irq_next_free = isrc->isrc_irq;
+
irq_sources[isrc->isrc_irq] = NULL;
isrc->isrc_irq = INTR_IRQ_INVALID; /* just to be safe */
return (0);

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 13, 8:02 PM (5 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23666578
Default Alt Text
D29310.id.diff (1 KB)

Event Timeline