Skip to content

Commit 45b26dd

Browse files
afzalmamKAGA-KOKO
authored andcommitted
hexagon: Replace setup_irq() by request_irq()
request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready. setup_irq() was required in older kernels as the memory allocator was not available during early boot. Hence replace setup_irq() by request_irq(). Signed-off-by: afzal mohammed <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/e84ac60de8f747d49ce082659e51595f708c29d4.1585320721.git.afzal.mohd.ma@gmail.com
1 parent e13b99f commit 45b26dd

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

arch/hexagon/kernel/smp.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ void send_ipi(const struct cpumask *cpumask, enum ipi_message_type msg)
114114
local_irq_restore(flags);
115115
}
116116

117-
static struct irqaction ipi_intdesc = {
118-
.handler = handle_ipi,
119-
.flags = IRQF_TRIGGER_RISING,
120-
.name = "ipi_handler"
121-
};
122-
123117
void __init smp_prepare_boot_cpu(void)
124118
{
125119
}
@@ -132,8 +126,8 @@ void __init smp_prepare_boot_cpu(void)
132126

133127
void start_secondary(void)
134128
{
135-
unsigned int cpu;
136129
unsigned long thread_ptr;
130+
unsigned int cpu, irq;
137131

138132
/* Calculate thread_info pointer from stack pointer */
139133
__asm__ __volatile__(
@@ -155,7 +149,10 @@ void start_secondary(void)
155149

156150
cpu = smp_processor_id();
157151

158-
setup_irq(BASE_IPI_IRQ + cpu, &ipi_intdesc);
152+
irq = BASE_IPI_IRQ + cpu;
153+
if (request_irq(irq, handle_ipi, IRQF_TRIGGER_RISING, "ipi_handler",
154+
NULL))
155+
pr_err("Failed to request irq %u (ipi_handler)\n", irq);
159156

160157
/* Register the clock_event dummy */
161158
setup_percpu_clockdev();
@@ -201,7 +198,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
201198

202199
void __init smp_prepare_cpus(unsigned int max_cpus)
203200
{
204-
int i;
201+
int i, irq = BASE_IPI_IRQ;
205202

206203
/*
207204
* should eventually have some sort of machine
@@ -213,8 +210,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
213210
set_cpu_present(i, true);
214211

215212
/* Also need to register the interrupts for IPI */
216-
if (max_cpus > 1)
217-
setup_irq(BASE_IPI_IRQ, &ipi_intdesc);
213+
if (max_cpus > 1) {
214+
if (request_irq(irq, handle_ipi, IRQF_TRIGGER_RISING,
215+
"ipi_handler", NULL))
216+
pr_err("Failed to request irq %d (ipi_handler)\n", irq);
217+
}
218218
}
219219

220220
void smp_send_reschedule(int cpu)

arch/hexagon/kernel/time.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,6 @@ static irqreturn_t timer_interrupt(int irq, void *devid)
143143
return IRQ_HANDLED;
144144
}
145145

146-
/* This should also be pulled from devtree */
147-
static struct irqaction rtos_timer_intdesc = {
148-
.handler = timer_interrupt,
149-
.flags = IRQF_TIMER | IRQF_TRIGGER_RISING,
150-
.name = "rtos_timer"
151-
};
152-
153146
/*
154147
* time_init_deferred - called by start_kernel to set up timer/clock source
155148
*
@@ -163,6 +156,7 @@ void __init time_init_deferred(void)
163156
{
164157
struct resource *resource = NULL;
165158
struct clock_event_device *ce_dev = &hexagon_clockevent_dev;
159+
unsigned long flag = IRQF_TIMER | IRQF_TRIGGER_RISING;
166160

167161
ce_dev->cpumask = cpu_all_mask;
168162

@@ -195,7 +189,8 @@ void __init time_init_deferred(void)
195189
#endif
196190

197191
clockevents_register_device(ce_dev);
198-
setup_irq(ce_dev->irq, &rtos_timer_intdesc);
192+
if (request_irq(ce_dev->irq, timer_interrupt, flag, "rtos_timer", NULL))
193+
pr_err("Failed to register rtos_timer interrupt\n");
199194
}
200195

201196
void __init time_init(void)

0 commit comments

Comments
 (0)