Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30472
b: refs/heads/master
c: 26a3c49
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jun 26, 2006
1 parent aec1974 commit da9925f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 357c2b9056df447390b7df3e49960a4c609a89a9
refs/heads/master: 26a3c49cec96ffb9cfcc30dfa0cd05ccc25dcb3a
9 changes: 5 additions & 4 deletions trunk/arch/i386/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,14 +1163,15 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
int assign_irq_vector(int irq)
{
static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
unsigned long flags;
int vector;

BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);

spin_lock(&vector_lock);
spin_lock_irqsave(&vector_lock, flags);

if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
spin_unlock(&vector_lock);
spin_unlock_irqrestore(&vector_lock, flags);
return IO_APIC_VECTOR(irq);
}
next:
Expand All @@ -1181,7 +1182,7 @@ int assign_irq_vector(int irq)
if (current_vector >= FIRST_SYSTEM_VECTOR) {
offset++;
if (!(offset%8)) {
spin_unlock(&vector_lock);
spin_unlock_irqrestore(&vector_lock, flags);
return -ENOSPC;
}
current_vector = FIRST_DEVICE_VECTOR + offset;
Expand All @@ -1192,7 +1193,7 @@ int assign_irq_vector(int irq)
if (irq != AUTO_ASSIGN)
IO_APIC_VECTOR(irq) = vector;

spin_unlock(&vector_lock);
spin_unlock_irqrestore(&vector_lock, flags);

return vector;
}
Expand Down
7 changes: 4 additions & 3 deletions trunk/arch/x86_64/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,14 +836,15 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
int assign_irq_vector(int irq)
{
static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
unsigned long flags;
int vector;

BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);

spin_lock(&vector_lock);
spin_lock_irqsave(&vector_lock, flags);

if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
spin_unlock(&vector_lock);
spin_unlock_irqrestore(&vector_lock, flags);
return IO_APIC_VECTOR(irq);
}
next:
Expand All @@ -862,7 +863,7 @@ int assign_irq_vector(int irq)
if (irq != AUTO_ASSIGN)
IO_APIC_VECTOR(irq) = vector;

spin_unlock(&vector_lock);
spin_unlock_irqrestore(&vector_lock, flags);

return vector;
}
Expand Down

0 comments on commit da9925f

Please sign in to comment.