clocksource: Replace setup_irq() by request_irq()
request_irq() is preferred over setup_irq(). The early boot setup_irq() invocations happen either via 'init_IRQ()' or 'time_init()', while memory allocators are ready by 'mm_init()'. 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(). Seldom remove_irq() usage has been observed coupled with setup_irq(), wherever that has been found, it too has been replaced by free_irq(). A build error that was reported by kbuild test robot <lkp@intel.com> in the previous version of the patch also has 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: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/91961c77c1cf93d41523f5e1ac52043f32f97077.1582799709.git.afzal.mohd.ma@gmail.com
This commit is contained in:

committed by
Daniel Lezcano

parent
a7cd395521
commit
cc2550b421
@@ -159,29 +159,23 @@ static struct clocksource sirfsoc_clocksource = {
|
||||
.resume = sirfsoc_clocksource_resume,
|
||||
};
|
||||
|
||||
static struct irqaction sirfsoc_timer_irq = {
|
||||
.name = "sirfsoc_timer0",
|
||||
.flags = IRQF_TIMER | IRQF_NOBALANCING,
|
||||
.handler = sirfsoc_timer_interrupt,
|
||||
};
|
||||
|
||||
static struct irqaction sirfsoc_timer1_irq = {
|
||||
.name = "sirfsoc_timer1",
|
||||
.flags = IRQF_TIMER | IRQF_NOBALANCING,
|
||||
.handler = sirfsoc_timer_interrupt,
|
||||
};
|
||||
static unsigned int sirfsoc_timer_irq, sirfsoc_timer1_irq;
|
||||
|
||||
static int sirfsoc_local_timer_starting_cpu(unsigned int cpu)
|
||||
{
|
||||
struct clock_event_device *ce = per_cpu_ptr(sirfsoc_clockevent, cpu);
|
||||
struct irqaction *action;
|
||||
unsigned int irq;
|
||||
const char *name;
|
||||
|
||||
if (cpu == 0)
|
||||
action = &sirfsoc_timer_irq;
|
||||
else
|
||||
action = &sirfsoc_timer1_irq;
|
||||
if (cpu == 0) {
|
||||
irq = sirfsoc_timer_irq;
|
||||
name = "sirfsoc_timer0";
|
||||
} else {
|
||||
irq = sirfsoc_timer1_irq;
|
||||
name = "sirfsoc_timer1";
|
||||
}
|
||||
|
||||
ce->irq = action->irq;
|
||||
ce->irq = irq;
|
||||
ce->name = "local_timer";
|
||||
ce->features = CLOCK_EVT_FEAT_ONESHOT;
|
||||
ce->rating = 200;
|
||||
@@ -196,9 +190,9 @@ static int sirfsoc_local_timer_starting_cpu(unsigned int cpu)
|
||||
ce->min_delta_ticks = 2;
|
||||
ce->cpumask = cpumask_of(cpu);
|
||||
|
||||
action->dev_id = ce;
|
||||
BUG_ON(setup_irq(ce->irq, action));
|
||||
irq_force_affinity(action->irq, cpumask_of(cpu));
|
||||
BUG_ON(request_irq(ce->irq, sirfsoc_timer_interrupt,
|
||||
IRQF_TIMER | IRQF_NOBALANCING, name, ce));
|
||||
irq_force_affinity(ce->irq, cpumask_of(cpu));
|
||||
|
||||
clockevents_register_device(ce);
|
||||
return 0;
|
||||
@@ -206,12 +200,14 @@ static int sirfsoc_local_timer_starting_cpu(unsigned int cpu)
|
||||
|
||||
static int sirfsoc_local_timer_dying_cpu(unsigned int cpu)
|
||||
{
|
||||
struct clock_event_device *ce = per_cpu_ptr(sirfsoc_clockevent, cpu);
|
||||
|
||||
sirfsoc_timer_count_disable(1);
|
||||
|
||||
if (cpu == 0)
|
||||
remove_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq);
|
||||
free_irq(sirfsoc_timer_irq, ce);
|
||||
else
|
||||
remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq);
|
||||
free_irq(sirfsoc_timer1_irq, ce);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -268,14 +264,14 @@ static int __init sirfsoc_of_timer_init(struct device_node *np)
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0);
|
||||
if (!sirfsoc_timer_irq.irq) {
|
||||
sirfsoc_timer_irq = irq_of_parse_and_map(np, 0);
|
||||
if (!sirfsoc_timer_irq) {
|
||||
pr_err("No irq passed for timer0 via DT\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sirfsoc_timer1_irq.irq = irq_of_parse_and_map(np, 1);
|
||||
if (!sirfsoc_timer1_irq.irq) {
|
||||
sirfsoc_timer1_irq = irq_of_parse_and_map(np, 1);
|
||||
if (!sirfsoc_timer1_irq) {
|
||||
pr_err("No irq passed for timer1 via DT\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user