MIPS: 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(). remove_irq() has been replaced by free_irq() as well. There were build error's during previous version, couple of which was reported by kbuild test robot <lkp@intel.com> of which one was reported by Thomas Bogendoerfer <tsbogend@alpha.franken.de> as well. There were a few more issues including build errors, those also have been fixed. [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos Signed-off-by: afzal mohammed <afzal.mohd.ma@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:

committed by
Thomas Bogendoerfer

parent
792a402c28
commit
ac8fd122e0
@@ -91,16 +91,15 @@ static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
|
||||
}
|
||||
|
||||
static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
|
||||
static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
|
||||
static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
|
||||
|
||||
void sb1480_clockevent_init(void)
|
||||
{
|
||||
unsigned int cpu = smp_processor_id();
|
||||
unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu;
|
||||
struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
|
||||
struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
|
||||
unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
|
||||
unsigned long flags = IRQF_PERCPU | IRQF_TIMER;
|
||||
|
||||
BUG_ON(cpu > 3); /* Only have 4 general purpose timers */
|
||||
|
||||
@@ -133,11 +132,7 @@ void sb1480_clockevent_init(void)
|
||||
|
||||
bcm1480_unmask_irq(cpu, irq);
|
||||
|
||||
action->handler = sibyte_counter_handler;
|
||||
action->flags = IRQF_PERCPU | IRQF_TIMER;
|
||||
action->name = name;
|
||||
action->dev_id = cd;
|
||||
|
||||
irq_set_affinity(irq, cpumask_of(cpu));
|
||||
setup_irq(irq, action);
|
||||
if (request_irq(irq, sibyte_counter_handler, flags, name, cd))
|
||||
pr_err("Failed to request irq %d (%s)\n", irq, name);
|
||||
}
|
||||
|
@@ -100,14 +100,9 @@ static irqreturn_t ds1287_interrupt(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static struct irqaction ds1287_irqaction = {
|
||||
.handler = ds1287_interrupt,
|
||||
.flags = IRQF_PERCPU | IRQF_TIMER,
|
||||
.name = "ds1287",
|
||||
};
|
||||
|
||||
int __init ds1287_clockevent_init(int irq)
|
||||
{
|
||||
unsigned long flags = IRQF_PERCPU | IRQF_TIMER;
|
||||
struct clock_event_device *cd;
|
||||
|
||||
cd = &ds1287_clockevent;
|
||||
@@ -122,5 +117,5 @@ int __init ds1287_clockevent_init(int irq)
|
||||
|
||||
clockevents_register_device(&ds1287_clockevent);
|
||||
|
||||
return setup_irq(irq, &ds1287_irqaction);
|
||||
return request_irq(irq, ds1287_interrupt, flags, "ds1287", NULL);
|
||||
}
|
||||
|
@@ -120,12 +120,6 @@ static irqreturn_t gt641xx_timer0_interrupt(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static struct irqaction gt641xx_timer0_irqaction = {
|
||||
.handler = gt641xx_timer0_interrupt,
|
||||
.flags = IRQF_PERCPU | IRQF_TIMER,
|
||||
.name = "gt641xx_timer0",
|
||||
};
|
||||
|
||||
static int __init gt641xx_timer0_clockevent_init(void)
|
||||
{
|
||||
struct clock_event_device *cd;
|
||||
@@ -146,6 +140,7 @@ static int __init gt641xx_timer0_clockevent_init(void)
|
||||
|
||||
clockevents_register_device(>641xx_timer0_clockevent);
|
||||
|
||||
return setup_irq(GT641XX_TIMER0_IRQ, >641xx_timer0_irqaction);
|
||||
return request_irq(GT641XX_TIMER0_IRQ, gt641xx_timer0_interrupt,
|
||||
IRQF_PERCPU | IRQF_TIMER, "gt641xx_timer0", NULL);
|
||||
}
|
||||
arch_initcall(gt641xx_timer0_clockevent_init);
|
||||
|
@@ -252,6 +252,7 @@ unsigned int __weak get_c0_compare_int(void)
|
||||
|
||||
int r4k_clockevent_init(void)
|
||||
{
|
||||
unsigned long flags = IRQF_PERCPU | IRQF_TIMER | IRQF_SHARED;
|
||||
unsigned int cpu = smp_processor_id();
|
||||
struct clock_event_device *cd;
|
||||
unsigned int irq, min_delta;
|
||||
@@ -291,7 +292,8 @@ int r4k_clockevent_init(void)
|
||||
|
||||
cp0_timer_irq_installed = 1;
|
||||
|
||||
setup_irq(irq, &c0_compare_irqaction);
|
||||
if (request_irq(irq, c0_compare_interrupt, flags, "timer", NULL))
|
||||
pr_err("Failed to request irq %d (timer)\n", irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -90,16 +90,15 @@ static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
|
||||
}
|
||||
|
||||
static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
|
||||
static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
|
||||
static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
|
||||
|
||||
void sb1250_clockevent_init(void)
|
||||
{
|
||||
unsigned int cpu = smp_processor_id();
|
||||
unsigned int irq = K_INT_TIMER_0 + cpu;
|
||||
struct irqaction *action = &per_cpu(sibyte_hpt_irqaction, cpu);
|
||||
struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
|
||||
unsigned char *name = per_cpu(sibyte_hpt_name, cpu);
|
||||
unsigned long flags = IRQF_PERCPU | IRQF_TIMER;
|
||||
|
||||
/* Only have 4 general purpose timers, and we use last one as hpt */
|
||||
BUG_ON(cpu > 2);
|
||||
@@ -133,11 +132,7 @@ void sb1250_clockevent_init(void)
|
||||
|
||||
sb1250_unmask_irq(cpu, irq);
|
||||
|
||||
action->handler = sibyte_counter_handler;
|
||||
action->flags = IRQF_PERCPU | IRQF_TIMER;
|
||||
action->name = name;
|
||||
action->dev_id = cd;
|
||||
|
||||
irq_set_affinity(irq, cpumask_of(cpu));
|
||||
setup_irq(irq, action);
|
||||
if (request_irq(irq, sibyte_counter_handler, flags, name, cd))
|
||||
pr_err("Failed to request irq %d (%s)\n", irq, name);
|
||||
}
|
||||
|
@@ -174,13 +174,6 @@ static irqreturn_t txx9tmr_interrupt(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static struct irqaction txx9tmr_irq = {
|
||||
.handler = txx9tmr_interrupt,
|
||||
.flags = IRQF_PERCPU | IRQF_TIMER,
|
||||
.name = "txx9tmr",
|
||||
.dev_id = &txx9_clock_event_device,
|
||||
};
|
||||
|
||||
void __init txx9_clockevent_init(unsigned long baseaddr, int irq,
|
||||
unsigned int imbusclk)
|
||||
{
|
||||
@@ -202,7 +195,9 @@ void __init txx9_clockevent_init(unsigned long baseaddr, int irq,
|
||||
cd->irq = irq;
|
||||
cd->cpumask = cpumask_of(0),
|
||||
clockevents_register_device(cd);
|
||||
setup_irq(irq, &txx9tmr_irq);
|
||||
if (request_irq(irq, txx9tmr_interrupt, IRQF_PERCPU | IRQF_TIMER,
|
||||
"txx9tmr", &txx9_clock_event_device))
|
||||
pr_err("Failed to request irq %d (txx9tmr)\n", irq);
|
||||
printk(KERN_INFO "TXx9: clockevent device at 0x%lx, irq %d\n",
|
||||
baseaddr, irq);
|
||||
}
|
||||
|
@@ -18,16 +18,13 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static struct irqaction irq0 = {
|
||||
.handler = timer_interrupt,
|
||||
.flags = IRQF_NOBALANCING | IRQF_TIMER,
|
||||
.name = "timer"
|
||||
};
|
||||
|
||||
void __init setup_pit_timer(void)
|
||||
{
|
||||
unsigned long flags = IRQF_NOBALANCING | IRQF_TIMER;
|
||||
|
||||
clockevent_i8253_init(true);
|
||||
setup_irq(0, &irq0);
|
||||
if (request_irq(0, timer_interrupt, flags, "timer", NULL))
|
||||
pr_err("Failed to request irq 0 (timer)\n");
|
||||
}
|
||||
|
||||
static int __init init_pit_clocksource(void)
|
||||
|
@@ -51,11 +51,6 @@ static irqreturn_t rtlx_interrupt(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static struct irqaction rtlx_irq = {
|
||||
.handler = rtlx_interrupt,
|
||||
.name = "RTLX",
|
||||
};
|
||||
|
||||
static int rtlx_irq_num = MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ;
|
||||
|
||||
void _interrupt_sp(void)
|
||||
@@ -124,8 +119,7 @@ int __init rtlx_module_init(void)
|
||||
goto out_class;
|
||||
}
|
||||
|
||||
rtlx_irq.dev_id = rtlx;
|
||||
err = setup_irq(rtlx_irq_num, &rtlx_irq);
|
||||
err = request_irq(rtlx_irq_num, rtlx_interrupt, 0, "RTLX", rtlx);
|
||||
if (err)
|
||||
goto out_class;
|
||||
|
||||
|
@@ -207,25 +207,13 @@ static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static struct irqaction irq_resched = {
|
||||
.handler = ipi_resched_interrupt,
|
||||
.flags = IRQF_PERCPU,
|
||||
.name = "IPI resched"
|
||||
};
|
||||
|
||||
static struct irqaction irq_call = {
|
||||
.handler = ipi_call_interrupt,
|
||||
.flags = IRQF_PERCPU,
|
||||
.name = "IPI call"
|
||||
};
|
||||
|
||||
static void smp_ipi_init_one(unsigned int virq,
|
||||
struct irqaction *action)
|
||||
static void smp_ipi_init_one(unsigned int virq, const char *name,
|
||||
irq_handler_t handler)
|
||||
{
|
||||
int ret;
|
||||
|
||||
irq_set_handler(virq, handle_percpu_irq);
|
||||
ret = setup_irq(virq, action);
|
||||
ret = request_irq(virq, handler, IRQF_PERCPU, name, NULL);
|
||||
BUG_ON(ret);
|
||||
}
|
||||
|
||||
@@ -278,12 +266,15 @@ int mips_smp_ipi_allocate(const struct cpumask *mask)
|
||||
int cpu;
|
||||
|
||||
for_each_cpu(cpu, mask) {
|
||||
smp_ipi_init_one(call_virq + cpu, &irq_call);
|
||||
smp_ipi_init_one(sched_virq + cpu, &irq_resched);
|
||||
smp_ipi_init_one(call_virq + cpu, "IPI call",
|
||||
ipi_call_interrupt);
|
||||
smp_ipi_init_one(sched_virq + cpu, "IPI resched",
|
||||
ipi_resched_interrupt);
|
||||
}
|
||||
} else {
|
||||
smp_ipi_init_one(call_virq, &irq_call);
|
||||
smp_ipi_init_one(sched_virq, &irq_resched);
|
||||
smp_ipi_init_one(call_virq, "IPI call", ipi_call_interrupt);
|
||||
smp_ipi_init_one(sched_virq, "IPI resched",
|
||||
ipi_resched_interrupt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -311,8 +302,8 @@ int mips_smp_ipi_free(const struct cpumask *mask)
|
||||
int cpu;
|
||||
|
||||
for_each_cpu(cpu, mask) {
|
||||
remove_irq(call_virq + cpu, &irq_call);
|
||||
remove_irq(sched_virq + cpu, &irq_resched);
|
||||
free_irq(call_virq + cpu, NULL);
|
||||
free_irq(sched_virq + cpu, NULL);
|
||||
}
|
||||
}
|
||||
irq_destroy_ipi(call_virq, mask);
|
||||
|
Reference in New Issue
Block a user