提交 6ebcc00e 编写于 作者: J Jan Beulich 提交者: Linus Torvalds

[PATCH] i386/x86-64: simplify ioapic_register_intr()

Simplify (remove duplication of) code in ioapic_register_intr().
Signed-off-by: NJan Beulich <jbeulich@novell.com>
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 0a1ad60d
...@@ -1205,21 +1205,14 @@ static struct hw_interrupt_type ioapic_edge_type; ...@@ -1205,21 +1205,14 @@ static struct hw_interrupt_type ioapic_edge_type;
static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger) static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger)
{ {
if (use_pci_vector() && !platform_legacy_irq(irq)) { unsigned idx = use_pci_vector() && !platform_legacy_irq(irq) ? vector : irq;
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
trigger == IOAPIC_LEVEL) if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
irq_desc[vector].handler = &ioapic_level_type; trigger == IOAPIC_LEVEL)
else irq_desc[idx].handler = &ioapic_level_type;
irq_desc[vector].handler = &ioapic_edge_type; else
set_intr_gate(vector, interrupt[vector]); irq_desc[idx].handler = &ioapic_edge_type;
} else { set_intr_gate(vector, interrupt[idx]);
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
trigger == IOAPIC_LEVEL)
irq_desc[irq].handler = &ioapic_level_type;
else
irq_desc[irq].handler = &ioapic_edge_type;
set_intr_gate(vector, interrupt[irq]);
}
} }
static void __init setup_IO_APIC_irqs(void) static void __init setup_IO_APIC_irqs(void)
......
...@@ -876,21 +876,14 @@ static struct hw_interrupt_type ioapic_edge_type; ...@@ -876,21 +876,14 @@ static struct hw_interrupt_type ioapic_edge_type;
static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger) static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger)
{ {
if (use_pci_vector() && !platform_legacy_irq(irq)) { unsigned idx = use_pci_vector() && !platform_legacy_irq(irq) ? vector : irq;
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
trigger == IOAPIC_LEVEL) if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
irq_desc[vector].handler = &ioapic_level_type; trigger == IOAPIC_LEVEL)
else irq_desc[idx].handler = &ioapic_level_type;
irq_desc[vector].handler = &ioapic_edge_type; else
set_intr_gate(vector, interrupt[vector]); irq_desc[idx].handler = &ioapic_edge_type;
} else { set_intr_gate(vector, interrupt[idx]);
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
trigger == IOAPIC_LEVEL)
irq_desc[irq].handler = &ioapic_level_type;
else
irq_desc[irq].handler = &ioapic_edge_type;
set_intr_gate(vector, interrupt[irq]);
}
} }
static void __init setup_IO_APIC_irqs(void) static void __init setup_IO_APIC_irqs(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册