summary refs log tree commit diff
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-04-05 22:39:04 +0900
committerIngo Molnar <mingo@elte.hu>2008-04-17 17:41:36 +0200
commit9d25cb0811fd0bca2cfd80095ee7663147363f68 (patch)
tree68e71d96df59439db449c417393cd7cfb03ed92a
parent03056c88cf65ec8375753900246b36ae1c4b8a33 (diff)
downloadlinux-9d25cb0811fd0bca2cfd80095ee7663147363f68.tar.gz
x86: avoid redundant loop in io_apic_level_ack_pending()
If one can find an ack pending pin, there is no need to check
the rest of them.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/io_apic_64.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 65b6840e1820..cd01f3aa17ba 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -167,11 +167,10 @@ static inline void io_apic_modify(unsigned int apic, unsigned int value)
 	writel(value, &io_apic->data);
 }
 
-static int io_apic_level_ack_pending(unsigned int irq)
+static bool io_apic_level_ack_pending(unsigned int irq)
 {
 	struct irq_pin_list *entry;
 	unsigned long flags;
-	int pending = 0;
 
 	spin_lock_irqsave(&ioapic_lock, flags);
 	entry = irq_2_pin + irq;
@@ -184,13 +183,17 @@ static int io_apic_level_ack_pending(unsigned int irq)
 			break;
 		reg = io_apic_read(entry->apic, 0x10 + pin*2);
 		/* Is the remote IRR bit set? */
-		pending |= (reg >> 14) & 1;
+		if ((reg >> 14) & 1) {
+			spin_unlock_irqrestore(&ioapic_lock, flags);
+			return true;
+		}
 		if (!entry->next)
 			break;
 		entry = irq_2_pin + entry->next;
 	}
 	spin_unlock_irqrestore(&ioapic_lock, flags);
-	return pending;
+
+	return false;
 }
 
 /*