xtensa: replace setup_irq() by request_irq()
PATCH v3 1/1 xtensa: 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 Max Filippov,
i believe you are the maintainer of xtensa, if you are 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/xtensa/kernel/smp.c | 8 ++------ arch/xtensa/kernel/time.c | 12 +++++------- 2 files changed, 7 insertions(+), 13 deletions(-)
arch/xtensa/kernel/smp.c +2 -6
@@ -53,16 +53,12 @@ static void system_flush_invalidate_dcache_range(unsigned long start,#define IPI_IRQ 0static irqreturn_t ipi_interrupt (int irq,void *dev_id); -static struct irqaction ipi_irqaction = { - .handler = ipi_interrupt, - .flags =IRQF_PERCPU , - .name ="ipi" , -};void ipi_init (void ) {unsigned irq =irq_create_mapping (NULL ,IPI_IRQ ); -setup_irq (irq, &ipi_irqaction); +if (request_irq (irq, ipi_interrupt,IRQF_PERCPU ,"ipi" ,NULL )) +pr_err ("Failed to request irq %u (ipi)\n" , irq); }static inline unsigned int get_core_count (void )
arch/xtensa/kernel/time.c +5 -7
@@ -128,12 +128,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -static struct irqaction timer_irqaction = { - .handler = timer_interrupt, - .flags =IRQF_TIMER , - .name ="timer" , -}; -void local_timer_setup (unsigned cpu) {struct ccount_timer *timer = &per_cpu (ccount_timer, cpu);
@@ -184,6 +178,8 @@ static inline void calibrate_ccount(void)void __init time_init (void ) { +int irq; +of_clk_init (NULL );#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT pr_info ("Calibrating CPU frequency " );
@@ -199,7 +195,9 @@ void __init time_init(void) __func__);clocksource_register_hz (&ccount_clocksource, ccount_freq);local_timer_setup (0 ); -setup_irq (this_cpu_ptr (&ccount_timer)->evt.irq, &timer_irqaction); + irq =this_cpu_ptr (&ccount_timer)->evt.irq; +if (request_irq (irq, timer_interrupt,IRQF_TIMER ,"timer" ,NULL )) +pr_err ("Failed to request irq %d (timer)\n" , irq);sched_clock_register (ccount_sched_clock_read,32 , ccount_freq);timer_probe (); }
Signature · 1 line
2.25.1
Max Filippov
maintainerQuoted 9 lines · afzal mohammed
request_irq()is preferred oversetup_irq(). Invocations ofsetup_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()byrequest_irq().
Quoted 8 lines
[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
Signed-off-by afzal mohammed <[email protected]>---
Hi Max Filippov,i believe you are the maintainer of xtensa, if you are okay w/ this change, please consider taking it thr' your tree, else please let me know.
Sure. Applied to my xtensa tree.
--
Thanks.
-- Max