[PATCH 1/3] MIPS: Replace setup_percpu_irq() by request_percpu_irq() variant
From: afzal mohammed
Date: Sat Apr 11 2020 - 12:04:39 EST
Recently all usages of setup_irq() was replaced by request_irq() as
allocators are ready by the time setup_irq() was invoked. Similarly
setup_percpu_irq() can be replaced by request_percpu_irq(). But in the
callers handled here __request_percpu_irq() has to be used as
request_percpu_irq() does not give the user a chance to pass the flags,
and IRQF_TIMER has to be passed here, so the variant
__request_percpu_irq() is used.
Signed-off-by: afzal mohammed <afzal.mohd.ma@xxxxxxxxx>
---
arch/mips/include/asm/cevt-r4k.h | 1 -
arch/mips/kernel/cevt-r4k.c | 11 -----------
arch/mips/sgi-ip27/ip27-timer.c | 13 +++++--------
arch/mips/sgi-ip30/ip30-timer.c | 6 +++---
4 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/arch/mips/include/asm/cevt-r4k.h b/arch/mips/include/asm/cevt-r4k.h
index 2e13a038d260..5229eb34f28a 100644
--- a/arch/mips/include/asm/cevt-r4k.h
+++ b/arch/mips/include/asm/cevt-r4k.h
@@ -23,7 +23,6 @@ void mips_event_handler(struct clock_event_device *dev);
int c0_compare_int_usable(void);
irqreturn_t c0_compare_interrupt(int, void *);
-extern struct irqaction c0_compare_irqaction;
extern int cp0_timer_irq_installed;
#endif /* __ASM_CEVT_R4K_H */
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 17a9cbb8b3df..4ffa9f485d07 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -158,17 +158,6 @@ irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
return IRQ_NONE;
}
-struct irqaction c0_compare_irqaction = {
- .handler = c0_compare_interrupt,
- /*
- * IRQF_SHARED: The timer interrupt may be shared with other interrupts
- * such as perf counter and FDC interrupts.
- */
- .flags = IRQF_PERCPU | IRQF_TIMER | IRQF_SHARED,
- .name = "timer",
-};
-
-
void mips_event_handler(struct clock_event_device *dev)
{
}
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 61f3565f3645..6e2b58b47580 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -68,13 +68,6 @@ static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
return IRQ_HANDLED;
}
-struct irqaction hub_rt_irqaction = {
- .handler = hub_rt_counter_handler,
- .percpu_dev_id = &hub_rt_clockevent,
- .flags = IRQF_PERCPU | IRQF_TIMER,
- .name = "hub-rt",
-};
-
/*
* This is a hack; we really need to figure these values out dynamically
*
@@ -111,9 +104,13 @@ void hub_rt_clock_event_init(void)
static void __init hub_rt_clock_event_global_init(void)
{
+ int irq = IP27_RT_TIMER_IRQ;
+
irq_set_handler(IP27_RT_TIMER_IRQ, handle_percpu_devid_irq);
irq_set_percpu_devid(IP27_RT_TIMER_IRQ);
- setup_percpu_irq(IP27_RT_TIMER_IRQ, &hub_rt_irqaction);
+ if (__request_percpu_irq(irq, hub_rt_counter_handler, IRQF_TIMER,
+ "hub-rt", &hub_rt_clockevent) < 0)
+ pr_err("Failed to request percpu irq %d (hub-rt)\n", irq);
}
static u64 hub_rt_read(struct clocksource *cs)
diff --git a/arch/mips/sgi-ip30/ip30-timer.c b/arch/mips/sgi-ip30/ip30-timer.c
index d13e105478ae..dcc22eaddcda 100644
--- a/arch/mips/sgi-ip30/ip30-timer.c
+++ b/arch/mips/sgi-ip30/ip30-timer.c
@@ -52,11 +52,11 @@ void __init plat_time_init(void)
int irq = get_c0_compare_int();
cp0_timer_irq_installed = 1;
- c0_compare_irqaction.percpu_dev_id = &mips_clockevent_device;
- c0_compare_irqaction.flags &= ~IRQF_SHARED;
irq_set_handler(irq, handle_percpu_devid_irq);
irq_set_percpu_devid(irq);
- setup_percpu_irq(irq, &c0_compare_irqaction);
+ if (__request_percpu_irq(irq, c0_compare_interrupt, IRQF_TIMER, "timer",
+ &mips_clockevent_device) < 0)
+ pr_err("Failed to request percpu irq %d (timer)\n", irq);
enable_percpu_irq(irq, IRQ_TYPE_NONE);
ip30_heart_clocksource_init();
--
2.18.0