aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/io_apic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/io_apic.c')
-rw-r--r--arch/i386/kernel/io_apic.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 61317f4be444..72ae414e4d49 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -1163,14 +1163,15 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 };
1163int assign_irq_vector(int irq) 1163int assign_irq_vector(int irq)
1164{ 1164{
1165 static int current_vector = FIRST_DEVICE_VECTOR, offset = 0; 1165 static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
1166 unsigned long flags;
1166 int vector; 1167 int vector;
1167 1168
1168 BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); 1169 BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
1169 1170
1170 spin_lock(&vector_lock); 1171 spin_lock_irqsave(&vector_lock, flags);
1171 1172
1172 if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { 1173 if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
1173 spin_unlock(&vector_lock); 1174 spin_unlock_irqrestore(&vector_lock, flags);
1174 return IO_APIC_VECTOR(irq); 1175 return IO_APIC_VECTOR(irq);
1175 } 1176 }
1176next: 1177next:
@@ -1181,7 +1182,7 @@ next:
1181 if (current_vector >= FIRST_SYSTEM_VECTOR) { 1182 if (current_vector >= FIRST_SYSTEM_VECTOR) {
1182 offset++; 1183 offset++;
1183 if (!(offset%8)) { 1184 if (!(offset%8)) {
1184 spin_unlock(&vector_lock); 1185 spin_unlock_irqrestore(&vector_lock, flags);
1185 return -ENOSPC; 1186 return -ENOSPC;
1186 } 1187 }
1187 current_vector = FIRST_DEVICE_VECTOR + offset; 1188 current_vector = FIRST_DEVICE_VECTOR + offset;
@@ -1192,7 +1193,7 @@ next:
1192 if (irq != AUTO_ASSIGN) 1193 if (irq != AUTO_ASSIGN)
1193 IO_APIC_VECTOR(irq) = vector; 1194 IO_APIC_VECTOR(irq) = vector;
1194 1195
1195 spin_unlock(&vector_lock); 1196 spin_unlock_irqrestore(&vector_lock, flags);
1196 1197
1197 return vector; 1198 return vector;
1198} 1199}