* [PATCH -tip] x86, io-apic: Simplify ioapic_register_intr
@ 2010-10-18 21:21 Cyrill Gorcunov
0 siblings, 0 replies; only message in thread
From: Cyrill Gorcunov @ 2010-10-18 21:21 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: LKML
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@openvz.org>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-18 21:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-18 21:21 [PATCH -tip] x86, io-apic: Simplify ioapic_register_intr Cyrill Gorcunov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox