public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH -tip] x86, io-apic: Simplify ioapic_register_intr
Date: Tue, 19 Oct 2010 01:21:23 +0400	[thread overview]
Message-ID: <20101018212123.GA6545@lenovo> (raw)

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


                 reply	other threads:[~2010-10-18 21:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101018212123.GA6545@lenovo \
    --to=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox