Skip to contentSkip to conversation

unicore32: replace setup_irq() by request_irq()

PATCH Superseded afzal mohammed 1 participant 2 messages Mar 4, 2020 – Mar 13, 2020

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 unicore32: replace setup_irq() by request_irq()

request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready.

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().

[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos

---
Hi unicorn maintainers,

if okay w/ this change, please consider taking it thr' your tree, else please let me know.

Regards
afzal

Link to v2 & v1,
[v2] https://lkml.kernel.org/r/[email protected]
[v1] https://lkml.kernel.org/r/[email protected]

v3:
* Split out from tree wide series, as Thomas suggested to get it thr' respective maintainers
* Modify pr_err displayed in case of error
* Re-arrange code & choose pr_err args as required to improve readability
* Remove irrelevant parts from commit message & improve

v2:
* Replace pr_err("request_irq() on %s failed" by

           pr_err("%s: request_irq() failed"

* Commit message massage

 arch/unicore32/kernel/time.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
arch/unicore32/kernel/time.c +3 -8
index 8b217a761bf0..c3a37edf4d40 100644
@@ -72,13 +72,6 @@ static struct clocksource cksrc_puv3_oscr = {
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-static struct irqaction puv3_timer_irq = {
-	.name		= "ost0",
-	.flags		= IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= puv3_ost0_interrupt,
-	.dev_id		= &ckevt_puv3_osmr0,
-};
-
 void __init time_init(void)
 {
 	writel(0, OST_OIER);		/* disable any timer interrupts */
@@ -94,7 +87,9 @@ void __init time_init(void)
 	ckevt_puv3_osmr0.min_delta_ticks = MIN_OSCR_DELTA * 2;
 	ckevt_puv3_osmr0.cpumask = cpumask_of(0);
 
-	setup_irq(IRQ_TIMER0, &puv3_timer_irq);
+	if (request_irq(IRQ_TIMER0, puv3_ost0_interrupt,
+			IRQF_TIMER | IRQF_IRQPOLL, "ost0", &ckevt_puv3_osmr0))
+		pr_err("Failed to register ost0 interrupt\n");
 
 	clocksource_register_hz(&cksrc_puv3_oscr, CLOCK_TICK_RATE);
 	clockevents_register_device(&ckevt_puv3_osmr0);
Signature · 1 line
2.25.1
#1 lore raw

Hi Guan Xuetao,

Quoted 8 lines · afzal mohammed

request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready.

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().

Quoted 8 lines

[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos

---
Hi unicorn maintainers,

if okay w/ this change, please consider taking it thr' your tree, else please let me know.

i have not seen any recent pull request from you for unicore32, if this patch is okay, please consider ack-ing this so as to take via tglx.

Regards
afzal