All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i386/x86-64: simplify ioapic_register_intr()
@ 2006-04-26 14:10 Jan Beulich
  2006-04-26 14:14 ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2006-04-26 14:10 UTC (permalink / raw)
  To: Andreas Kleen, linux-kernel; +Cc: discuss

Simplify (remove duplication of) code in ioapic_register_intr().

Signed-off-by: Jan Beulich <jbeulich@novell.com>

diff -Npru /home/jbeulich/tmp/linux-2.6.17-rc2/arch/i386/kernel/io_apic.c
2.6.17-rc2-x86-ioapic_register_intr-simplify/arch/i386/kernel/io_apic.c
--- /home/jbeulich/tmp/linux-2.6.17-rc2/arch/i386/kernel/io_apic.c	2006-04-26 10:55:11.000000000 +0200
+++ 2.6.17-rc2-x86-ioapic_register_intr-simplify/arch/i386/kernel/io_apic.c	2006-04-25 15:38:32.000000000 +0200
@@ -1184,21 +1184,14 @@ static struct hw_interrupt_type ioapic_e
 
 static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 {
-	if (use_pci_vector() && !platform_legacy_irq(irq)) {
-		if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-				trigger == IOAPIC_LEVEL)
-			irq_desc[vector].handler = &ioapic_level_type;
-		else
-			irq_desc[vector].handler = &ioapic_edge_type;
-		set_intr_gate(vector, interrupt[vector]);
-	} else	{
-		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]);
-	}
+	unsigned idx = use_pci_vector() && !platform_legacy_irq(irq) ? vector : irq;
+
+	if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
+			trigger == IOAPIC_LEVEL)
+		irq_desc[idx].handler = &ioapic_level_type;
+	else
+		irq_desc[idx].handler = &ioapic_edge_type;
+	set_intr_gate(vector, interrupt[idx]);
 }
 
 static void __init setup_IO_APIC_irqs(void)
diff -Npru /home/jbeulich/tmp/linux-2.6.17-rc2/arch/x86_64/kernel/io_apic.c
2.6.17-rc2-x86-ioapic_register_intr-simplify/arch/x86_64/kernel/io_apic.c
--- /home/jbeulich/tmp/linux-2.6.17-rc2/arch/x86_64/kernel/io_apic.c	2006-04-26 10:55:24.000000000 +0200
+++ 2.6.17-rc2-x86-ioapic_register_intr-simplify/arch/x86_64/kernel/io_apic.c	2006-04-25 15:38:32.000000000 +0200
@@ -846,21 +846,14 @@ static struct hw_interrupt_type ioapic_e
 
 static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 {
-	if (use_pci_vector() && !platform_legacy_irq(irq)) {
-		if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-				trigger == IOAPIC_LEVEL)
-			irq_desc[vector].handler = &ioapic_level_type;
-		else
-			irq_desc[vector].handler = &ioapic_edge_type;
-		set_intr_gate(vector, interrupt[vector]);
-	} else	{
-		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]);
-	}
+	unsigned idx = use_pci_vector() && !platform_legacy_irq(irq) ? vector : irq;
+
+	if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
+			trigger == IOAPIC_LEVEL)
+		irq_desc[idx].handler = &ioapic_level_type;
+	else
+		irq_desc[idx].handler = &ioapic_edge_type;
+	set_intr_gate(vector, interrupt[idx]);
 }
 
 static void __init setup_IO_APIC_irqs(void)



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i386/x86-64: simplify ioapic_register_intr()
  2006-04-26 14:10 [PATCH] i386/x86-64: simplify ioapic_register_intr() Jan Beulich
@ 2006-04-26 14:14 ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2006-04-26 14:14 UTC (permalink / raw)
  To: Jan Beulich; +Cc: linux-kernel, discuss

On Wednesday 26 April 2006 16:10, Jan Beulich wrote:
> Simplify (remove duplication of) code in ioapic_register_intr().

Applied thanks.
-Andi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-26 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-26 14:10 [PATCH] i386/x86-64: simplify ioapic_register_intr() Jan Beulich
2006-04-26 14:14 ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.