Skip to content

Commit 6d2e16a

Browse files
fancerdlezcano
authored andcommitted
clocksource: dw_apb_timer_of: Fix missing clockevent timers
Commit 1002148 ("clocksource: dw_apb_timer_of: use clocksource_of_init") replaced a publicly available driver initialization method with one called by the timer_probe() method available after CLKSRC_OF. In current implementation it traverses all the timers available in the system and calls their initialization methods if corresponding devices were either in dtb or in acpi. But if before the commit any number of available timers would be installed as clockevent and clocksource devices, after that there would be at most two. The rest are just ignored since default case branch doesn't do anything. I don't see a reason of such behaviour, neither the commit message explains it. Moreover this might be wrong if on some platforms these timers might be used for different purpose, as virtually CPU-local clockevent timers and as an independent broadcast timer. So in order to keep the compatibility with the platforms where the order of the timers detection has some meaning, lets add the secondly discovered timer to be of clocksource/sched_clock type, while the very first and the others would provide the clockevents service. Fixes: 1002148 ("clocksource: dw_apb_timer_of: use clocksource_of_init") Signed-off-by: Serge Semin <[email protected]> Cc: Alexey Malahov <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Paul Burton <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Rob Herring <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 65e0f87 commit 6d2e16a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/clocksource/dw_apb_timer_of.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ static int num_called;
147147
static int __init dw_apb_timer_init(struct device_node *timer)
148148
{
149149
switch (num_called) {
150-
case 0:
151-
pr_debug("%s: found clockevent timer\n", __func__);
152-
add_clockevent(timer);
153-
break;
154150
case 1:
155151
pr_debug("%s: found clocksource timer\n", __func__);
156152
add_clocksource(timer);
@@ -161,6 +157,8 @@ static int __init dw_apb_timer_init(struct device_node *timer)
161157
#endif
162158
break;
163159
default:
160+
pr_debug("%s: found clockevent timer\n", __func__);
161+
add_clockevent(timer);
164162
break;
165163
}
166164

0 commit comments

Comments
 (0)