[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v9nsmhjj.fsf@nanos.tec.linutronix.de>
Date: Thu, 27 Feb 2020 11:49:20 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: afzal mohammed <afzal.mohd.ma@...il.com>,
linux-kernel@...r.kernel.org, x86@...nel.org
Cc: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Juergen Gross <jgross@...e.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 14/18] x86: Replace setup_irq() by request_irq()
afzal mohammed <afzal.mohd.ma@...il.com> writes:
> request_irq() is preferred over setup_irq(). Existing callers of
> setup_irq() reached mostly via 'init_IRQ()' & 'time_init()', while
> memory allocators are ready by 'mm_init()'.
>
> Per tglx[1], setup_irq() existed in olden days when allocators were not
> ready by the time early interrupts were initialized.
>
> Hence replace setup_irq() by request_irq().
>
> Seldom remove_irq() usage has been observed coupled with setup_irq(),
> wherever that has been found, it too has been replaced by free_irq().
Please do not copy the irrelevant parts of your boilerplate text into
individual changelogs. Changelogs should have the information which is
relevant to the patch they describe.
> @@ -104,6 +95,11 @@ 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("request_irq() on %s failed\n", "cascade");
What's the purpose of the %s indirection here?
Also that error message is not really helpful:
request_irq() on cascade failed
Something like:
Failed to request irq 2 (cascade).
Hmm?
> + }
> }
> diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
> index d8673d8a779b..0f9cb386d71f 100644
> --- a/arch/x86/kernel/time.c
> +++ b/arch/x86/kernel/time.c
> @@ -62,19 +62,15 @@ 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)
> {
> /*
> * Unconditionally register the legacy timer; 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,
> + IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, "timer",
> + NULL))
This is realy ugly.
unsigned long flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER;
....
if (request_irq(0, timer_interrupt, flags, "timer", NULL))
....
takes the same amount of lines, but is readable.
Thanks,
tglx
Powered by blists - more mailing lists