Commit 9d25cb08 authored by Akinobu Mita's avatar Akinobu Mita Committed by Ingo Molnar

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: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 03056c88
...@@ -167,11 +167,10 @@ static inline void io_apic_modify(unsigned int apic, unsigned int value) ...@@ -167,11 +167,10 @@ static inline void io_apic_modify(unsigned int apic, unsigned int value)
writel(value, &io_apic->data); 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; struct irq_pin_list *entry;
unsigned long flags; unsigned long flags;
int pending = 0;
spin_lock_irqsave(&ioapic_lock, flags); spin_lock_irqsave(&ioapic_lock, flags);
entry = irq_2_pin + irq; entry = irq_2_pin + irq;
...@@ -184,13 +183,17 @@ static int io_apic_level_ack_pending(unsigned int irq) ...@@ -184,13 +183,17 @@ static int io_apic_level_ack_pending(unsigned int irq)
break; break;
reg = io_apic_read(entry->apic, 0x10 + pin*2); reg = io_apic_read(entry->apic, 0x10 + pin*2);
/* Is the remote IRR bit set? */ /* 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) if (!entry->next)
break; break;
entry = irq_2_pin + entry->next; entry = irq_2_pin + entry->next;
} }
spin_unlock_irqrestore(&ioapic_lock, flags); spin_unlock_irqrestore(&ioapic_lock, flags);
return pending;
return false;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment