Subject: [tip: x86/cleanups] x86: Replace setup_irq() by request_irq()

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 4dd2a1b92b91b5f2acf853ee1dc0df135054698f
Gitweb: https://git.kernel.org/tip/4dd2a1b92b91b5f2acf853ee1dc0df135054698f
Author: afzal mohammed <[email protected]>
AuthorDate: Mon, 24 Feb 2020 06:22:26 +05:30
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Sat, 21 Mar 2020 15:15:47 +01:00

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

---
arch/x86/kernel/irqinit.c | 16 +++++-----------
arch/x86/kernel/time.c | 15 ++++++---------
2 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 1e5ad12..5aa523c 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -44,15 +44,6 @@
* (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");
+ }
}
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index d8673d8..8c5213e 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -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");
}


2020-03-21 17:27:28

by afzal mohammed

[permalink] [raw]
Subject: Re: [tip: x86/cleanups] x86: Replace setup_irq() by request_irq()

On Sat, Mar 21, 2020 at 02:21:56PM -0000, tip-bot2 for afzal mohammed wrote:

> The following commit has been merged into the x86/cleanups branch of tip:

> [ 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

Oh Thomas, you picked up v2, i had sent v3 [2], wherein i had taken
care of your comments on v1 [1] as well as with more commit message
tweaking (v2 was sent before you commented on v1)

You have mentioned about merging the series here [3], i have been
keeping in mind that and proceeding, but is delayed due to the reason
mentioned below.

i was planning to send this as well as the patches that are not taken
care by respective maintainers along with the core removal patch as a
series. The reason to delay is the concern over ARM & powerpc patches -
wanted to let the patches for those 2 arch's go in thr' respective
maintainers in their natural flow rather than keep pinging them.

powerpc - in patchworks it is shown as under review after passing all
the tests, so expecting it to go in soon.

ARM - i am expecting these to be picked up by Arnd/Olof shortly as
they are yet to pickup any of the pull requests for ARM, you have been
copied in the followup mail [4].

As of now only c6x, hexagon, sh, unicore32 & alpha are the ones that i
have to send you. All others have been picked up by respective
maintainers & are in next.

Regards
afzal

[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/[email protected]
[4] https://lkml.kernel.org/r/20200317043702.GA5852@afzalpc

2020-03-21 17:48:53

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [tip: x86/cleanups] x86: Replace setup_irq() by request_irq()

afzal mohammed <[email protected]> writes:

> On Sat, Mar 21, 2020 at 02:21:56PM -0000, tip-bot2 for afzal mohammed wrote:
> Oh Thomas, you picked up v2, i had sent v3 [2], wherein i had taken
> care of your comments on v1 [1] as well as with more commit message
> tweaking (v2 was sent before you commented on v1)

Bah. I somehow lost track ///

> powerpc - in patchworks it is shown as under review after passing all
> the tests, so expecting it to go in soon.

Ok.

> ARM - i am expecting these to be picked up by Arnd/Olof shortly as
> they are yet to pickup any of the pull requests for ARM, you have been
> copied in the followup mail [4].

Ok.

> As of now only c6x, hexagon, sh, unicore32 & alpha are the ones that i
> have to send you. All others have been picked up by respective
> maintainers & are in next.

Cool.