Skip to content

Commit 4dd2a1b

Browse files
afzalmamKAGA-KOKO
authored andcommitted
x86: Replace setup_irq() by request_irq()
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/17f85021f6877650a5b09e0212d88323e6a30fd0.1582471508.git.afzal.mohd.ma@gmail.com
1 parent e2bdafc commit 4dd2a1b

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

arch/x86/kernel/irqinit.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@
4444
* (these are usually mapped into the 0x30-0xff vector range)
4545
*/
4646

47-
/*
48-
* IRQ2 is cascade interrupt to second interrupt controller
49-
*/
50-
static struct irqaction irq2 = {
51-
.handler = no_action,
52-
.name = "cascade",
53-
.flags = IRQF_NO_THREAD,
54-
};
55-
5647
DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
5748
[0 ... NR_VECTORS - 1] = VECTOR_UNUSED,
5849
};
@@ -104,6 +95,9 @@ void __init native_init_IRQ(void)
10495
idt_setup_apic_and_irq_gates();
10596
lapic_assign_system_vectors();
10697

107-
if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
108-
setup_irq(2, &irq2);
98+
if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) {
99+
/* IRQ2 is cascade interrupt to second interrupt controller */
100+
if (request_irq(2, no_action, IRQF_NO_THREAD, "cascade", NULL))
101+
pr_err("%s: request_irq() failed\n", "cascade");
102+
}
109103
}

arch/x86/kernel/time.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,16 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
6262
return IRQ_HANDLED;
6363
}
6464

65-
static struct irqaction irq0 = {
66-
.handler = timer_interrupt,
67-
.flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
68-
.name = "timer"
69-
};
70-
7165
static void __init setup_default_timer_irq(void)
7266
{
67+
unsigned long flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER;
68+
7369
/*
74-
* Unconditionally register the legacy timer; even without legacy
75-
* PIC/PIT we need this for the HPET0 in legacy replacement mode.
70+
* Unconditionally register the legacy timer interrupt; even
71+
* without legacy PIC/PIT we need this for the HPET0 in legacy
72+
* replacement mode.
7673
*/
77-
if (setup_irq(0, &irq0))
74+
if (request_irq(0, timer_interrupt, flags, "timer", NULL))
7875
pr_info("Failed to register legacy timer interrupt\n");
7976
}
8077

0 commit comments

Comments
 (0)