[PATCH -tip] x86, io-apic: Simplify ioapic_register_intr
From: Cyrill Gorcunov
Date: Mon Oct 18 2010 - 17:21:33 EST
Instead of setting IRQ_LEVEL flag early and then check for
IRQ being remapped and spread set_irq_chip_and_handler_name
over function body several times, defer IRQ_LEVEL setting
and save irq_chip in local variable with subsequent call depending
on IRQ level. This seems to be more natural and easier to read
in result.
And 'trigger' parameter has int type, not long.
Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
---
Please review, thanks! Complains are welcome.
arch/x86/kernel/apic/io_apic.c | 37 ++++++++++++++-----------------------
1 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 98c27b3..af5c911 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1228,35 +1228,26 @@ static inline int IO_APIC_irq_trigger(int irq)
}
#endif
-static void ioapic_register_intr(unsigned int irq, unsigned long trigger)
+static void ioapic_register_intr(unsigned int irq, int trigger)
{
-
- if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
- trigger == IOAPIC_LEVEL)
- irq_set_status_flags(irq, IRQ_LEVEL);
- else
- irq_clear_status_flags(irq, IRQ_LEVEL);
+ struct irq_chip *chip;
if (irq_remapped(get_irq_chip_data(irq))) {
irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
- if (trigger)
- set_irq_chip_and_handler_name(irq, &ir_ioapic_chip,
- handle_fasteoi_irq,
- "fasteoi");
- else
- set_irq_chip_and_handler_name(irq, &ir_ioapic_chip,
- handle_edge_irq, "edge");
- return;
- }
+ chip = &ir_ioapic_chip;
+ } else
+ chip = &ioapic_chip;
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
- trigger == IOAPIC_LEVEL)
- set_irq_chip_and_handler_name(irq, &ioapic_chip,
- handle_fasteoi_irq,
- "fasteoi");
- else
- set_irq_chip_and_handler_name(irq, &ioapic_chip,
- handle_edge_irq, "edge");
+ trigger == IOAPIC_LEVEL) {
+ irq_set_status_flags(irq, IRQ_LEVEL);
+ set_irq_chip_and_handler_name(irq, chip,
+ handle_fasteoi_irq, "fasteoi");
+ } else {
+ irq_clear_status_flags(irq, IRQ_LEVEL);
+ set_irq_chip_and_handler_name(irq, chip,
+ handle_edge_irq, "edge");
+ }
}
static int setup_ioapic_entry(int apic_id, int irq,
--
1.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/