diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-04-05 09:39:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:36 -0400 |
commit | 9d25cb0811fd0bca2cfd80095ee7663147363f68 (patch) | |
tree | 68e71d96df59439db449c417393cd7cfb03ed92a /arch/x86 | |
parent | 03056c88cf65ec8375753900246b36ae1c4b8a33 (diff) |
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>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/io_apic_64.c | 11 |
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) | |||
167 | writel(value, &io_apic->data); | 167 | writel(value, &io_apic->data); |
168 | } | 168 | } |
169 | 169 | ||
170 | static int io_apic_level_ack_pending(unsigned int irq) | 170 | static bool io_apic_level_ack_pending(unsigned int irq) |
171 | { | 171 | { |
172 | struct irq_pin_list *entry; | 172 | struct irq_pin_list *entry; |
173 | unsigned long flags; | 173 | unsigned long flags; |
174 | int pending = 0; | ||
175 | 174 | ||
176 | spin_lock_irqsave(&ioapic_lock, flags); | 175 | spin_lock_irqsave(&ioapic_lock, flags); |
177 | entry = irq_2_pin + irq; | 176 | entry = irq_2_pin + irq; |
@@ -184,13 +183,17 @@ static int io_apic_level_ack_pending(unsigned int irq) | |||
184 | break; | 183 | break; |
185 | reg = io_apic_read(entry->apic, 0x10 + pin*2); | 184 | reg = io_apic_read(entry->apic, 0x10 + pin*2); |
186 | /* Is the remote IRR bit set? */ | 185 | /* Is the remote IRR bit set? */ |
187 | pending |= (reg >> 14) & 1; | 186 | if ((reg >> 14) & 1) { |
187 | spin_unlock_irqrestore(&ioapic_lock, flags); | ||
188 | return true; | ||
189 | } | ||
188 | if (!entry->next) | 190 | if (!entry->next) |
189 | break; | 191 | break; |
190 | entry = irq_2_pin + entry->next; | 192 | entry = irq_2_pin + entry->next; |
191 | } | 193 | } |
192 | spin_unlock_irqrestore(&ioapic_lock, flags); | 194 | spin_unlock_irqrestore(&ioapic_lock, flags); |
193 | return pending; | 195 | |
196 | return false; | ||
194 | } | 197 | } |
195 | 198 | ||
196 | /* | 199 | /* |