diff options
Diffstat (limited to 'drivers/clocksource/mips-gic-timer.c')
-rw-r--r-- | drivers/clocksource/mips-gic-timer.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 1572c7a778ab..d91e8725917c 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c | |||
@@ -49,10 +49,9 @@ struct irqaction gic_compare_irqaction = { | |||
49 | .name = "timer", | 49 | .name = "timer", |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static void gic_clockevent_cpu_init(struct clock_event_device *cd) | 52 | static void gic_clockevent_cpu_init(unsigned int cpu, |
53 | struct clock_event_device *cd) | ||
53 | { | 54 | { |
54 | unsigned int cpu = smp_processor_id(); | ||
55 | |||
56 | cd->name = "MIPS GIC"; | 55 | cd->name = "MIPS GIC"; |
57 | cd->features = CLOCK_EVT_FEAT_ONESHOT | | 56 | cd->features = CLOCK_EVT_FEAT_ONESHOT | |
58 | CLOCK_EVT_FEAT_C3STOP; | 57 | CLOCK_EVT_FEAT_C3STOP; |
@@ -79,19 +78,10 @@ static void gic_update_frequency(void *data) | |||
79 | clockevents_update_freq(this_cpu_ptr(&gic_clockevent_device), rate); | 78 | clockevents_update_freq(this_cpu_ptr(&gic_clockevent_device), rate); |
80 | } | 79 | } |
81 | 80 | ||
82 | static int gic_cpu_notifier(struct notifier_block *nb, unsigned long action, | 81 | static int gic_starting_cpu(unsigned int cpu) |
83 | void *data) | ||
84 | { | 82 | { |
85 | switch (action & ~CPU_TASKS_FROZEN) { | 83 | gic_clockevent_cpu_init(cpu, this_cpu_ptr(&gic_clockevent_device)); |
86 | case CPU_STARTING: | 84 | return 0; |
87 | gic_clockevent_cpu_init(this_cpu_ptr(&gic_clockevent_device)); | ||
88 | break; | ||
89 | case CPU_DYING: | ||
90 | gic_clockevent_cpu_exit(this_cpu_ptr(&gic_clockevent_device)); | ||
91 | break; | ||
92 | } | ||
93 | |||
94 | return NOTIFY_OK; | ||
95 | } | 85 | } |
96 | 86 | ||
97 | static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, | 87 | static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, |
@@ -105,10 +95,11 @@ static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, | |||
105 | return NOTIFY_OK; | 95 | return NOTIFY_OK; |
106 | } | 96 | } |
107 | 97 | ||
108 | 98 | static int gic_dying_cpu(unsigned int cpu) | |
109 | static struct notifier_block gic_cpu_nb = { | 99 | { |
110 | .notifier_call = gic_cpu_notifier, | 100 | gic_clockevent_cpu_exit(this_cpu_ptr(&gic_clockevent_device)); |
111 | }; | 101 | return 0; |
102 | } | ||
112 | 103 | ||
113 | static struct notifier_block gic_clk_nb = { | 104 | static struct notifier_block gic_clk_nb = { |
114 | .notifier_call = gic_clk_notifier, | 105 | .notifier_call = gic_clk_notifier, |
@@ -125,12 +116,9 @@ static int gic_clockevent_init(void) | |||
125 | if (ret < 0) | 116 | if (ret < 0) |
126 | return ret; | 117 | return ret; |
127 | 118 | ||
128 | ret = register_cpu_notifier(&gic_cpu_nb); | 119 | cpuhp_setup_state(CPUHP_AP_MIPS_GIC_TIMER_STARTING, |
129 | if (ret < 0) | 120 | "AP_MIPS_GIC_TIMER_STARTING", gic_starting_cpu, |
130 | pr_warn("GIC: Unable to register CPU notifier\n"); | 121 | gic_dying_cpu); |
131 | |||
132 | gic_clockevent_cpu_init(this_cpu_ptr(&gic_clockevent_device)); | ||
133 | |||
134 | return 0; | 122 | return 0; |
135 | } | 123 | } |
136 | 124 | ||