x86: Replace setup_irq() by request_irq()
authorafzal mohammed <afzal.mohd.ma@gmail.com>
Mon, 24 Feb 2020 00:52:26 +0000 (06:22 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 21 Mar 2020 14:15:47 +0000 (15:15 +0100)
request_irq() is preferred over setup_irq(). The early boot setup_irq()
invocations happen either via 'init_IRQ()' or 'time_init()', while
memory allocators are ready by 'mm_init()'.

setup_irq() was required in old kernels when allocators were not ready by
the time early interrupts were initialized.

Hence replace setup_irq() by request_irq().

[ tglx: Use a local variable and get rid of the line break. Tweak the
   comment a bit ]

Signed-off-by: afzal mohammed <afzal.mohd.ma@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/17f85021f6877650a5b09e0212d88323e6a30fd0.1582471508.git.afzal.mohd.ma@gmail.com
arch/x86/kernel/irqinit.c
arch/x86/kernel/time.c

index 1e5ad12..5aa523c 100644 (file)
  * (these are usually mapped into the 0x30-0xff vector range)
  */
 
-/*
- * IRQ2 is cascade interrupt to second interrupt controller
- */
-static struct irqaction irq2 = {
-       .handler = no_action,
-       .name = "cascade",
-       .flags = IRQF_NO_THREAD,
-};
-
 DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
        [0 ... NR_VECTORS - 1] = VECTOR_UNUSED,
 };
@@ -104,6 +95,9 @@ void __init native_init_IRQ(void)
        idt_setup_apic_and_irq_gates();
        lapic_assign_system_vectors();
 
-       if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
-               setup_irq(2, &irq2);
+       if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) {
+               /* IRQ2 is cascade interrupt to second interrupt controller */
+               if (request_irq(2, no_action, IRQF_NO_THREAD, "cascade", NULL))
+                       pr_err("%s: request_irq() failed\n", "cascade");
+       }
 }
index d8673d8..8c5213e 100644 (file)
@@ -62,19 +62,16 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static struct irqaction irq0  = {
-       .handler = timer_interrupt,
-       .flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
-       .name = "timer"
-};
-
 static void __init setup_default_timer_irq(void)
 {
+       unsigned long flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER;
+
        /*
-        * Unconditionally register the legacy timer; even without legacy
-        * PIC/PIT we need this for the HPET0 in legacy replacement mode.
+        * Unconditionally register the legacy timer interrupt; even
+        * without legacy PIC/PIT we need this for the HPET0 in legacy
+        * replacement mode.
         */
-       if (setup_irq(0, &irq0))
+       if (request_irq(0, timer_interrupt, flags, "timer", NULL))
                pr_info("Failed to register legacy timer interrupt\n");
 }