diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-06-06 12:01:09 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-06-28 04:19:28 -0400 |
commit | c41c96ddac8eec158f488be2e122dcfc40fd1823 (patch) | |
tree | 15060eb31d7a9bd92dc3733f06904e976c4a32c9 /drivers/clocksource/timer-atlas7.c | |
parent | 41505a208f5d48671fcc9efe67a71cc8e28df653 (diff) |
clocksource/drivers/atlas7: Convert init function to return error
The init functions do not return any error. They behave as the following:
- panic, thus leading to a kernel crash while another timer may work and
make the system boot up correctly
or
- print an error and let the caller unaware if the state of the system
Change that by converting the init functions to return an error conforming
to the CLOCKSOURCE_OF_RET prototype.
Proper error handling (rollback, errno value) will be changed later case
by case, thus this change just return back an error or success in the init
function.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/clocksource/timer-atlas7.c')
-rw-r--r-- | drivers/clocksource/timer-atlas7.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/clocksource/timer-atlas7.c b/drivers/clocksource/timer-atlas7.c index 27fa13680be1..7b1a0071a211 100644 --- a/drivers/clocksource/timer-atlas7.c +++ b/drivers/clocksource/timer-atlas7.c | |||
@@ -238,7 +238,7 @@ static struct notifier_block sirfsoc_cpu_nb = { | |||
238 | .notifier_call = sirfsoc_cpu_notify, | 238 | .notifier_call = sirfsoc_cpu_notify, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static void __init sirfsoc_clockevent_init(void) | 241 | static int __init sirfsoc_clockevent_init(void) |
242 | { | 242 | { |
243 | sirfsoc_clockevent = alloc_percpu(struct clock_event_device); | 243 | sirfsoc_clockevent = alloc_percpu(struct clock_event_device); |
244 | BUG_ON(!sirfsoc_clockevent); | 244 | BUG_ON(!sirfsoc_clockevent); |
@@ -246,11 +246,11 @@ static void __init sirfsoc_clockevent_init(void) | |||
246 | BUG_ON(register_cpu_notifier(&sirfsoc_cpu_nb)); | 246 | BUG_ON(register_cpu_notifier(&sirfsoc_cpu_nb)); |
247 | 247 | ||
248 | /* Immediately configure the timer on the boot CPU */ | 248 | /* Immediately configure the timer on the boot CPU */ |
249 | sirfsoc_local_timer_setup(this_cpu_ptr(sirfsoc_clockevent)); | 249 | return sirfsoc_local_timer_setup(this_cpu_ptr(sirfsoc_clockevent)); |
250 | } | 250 | } |
251 | 251 | ||
252 | /* initialize the kernel jiffy timer source */ | 252 | /* initialize the kernel jiffy timer source */ |
253 | static void __init sirfsoc_atlas7_timer_init(struct device_node *np) | 253 | static int __init sirfsoc_atlas7_timer_init(struct device_node *np) |
254 | { | 254 | { |
255 | struct clk *clk; | 255 | struct clk *clk; |
256 | 256 | ||
@@ -279,23 +279,29 @@ static void __init sirfsoc_atlas7_timer_init(struct device_node *np) | |||
279 | 279 | ||
280 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, atlas7_timer_rate)); | 280 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, atlas7_timer_rate)); |
281 | 281 | ||
282 | sirfsoc_clockevent_init(); | 282 | return sirfsoc_clockevent_init(); |
283 | } | 283 | } |
284 | 284 | ||
285 | static void __init sirfsoc_of_timer_init(struct device_node *np) | 285 | static int __init sirfsoc_of_timer_init(struct device_node *np) |
286 | { | 286 | { |
287 | sirfsoc_timer_base = of_iomap(np, 0); | 287 | sirfsoc_timer_base = of_iomap(np, 0); |
288 | if (!sirfsoc_timer_base) | 288 | if (!sirfsoc_timer_base) { |
289 | panic("unable to map timer cpu registers\n"); | 289 | pr_err("unable to map timer cpu registers\n"); |
290 | return -ENXIO; | ||
291 | } | ||
290 | 292 | ||
291 | sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0); | 293 | sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0); |
292 | if (!sirfsoc_timer_irq.irq) | 294 | if (!sirfsoc_timer_irq.irq) { |
293 | panic("No irq passed for timer0 via DT\n"); | 295 | pr_err("No irq passed for timer0 via DT\n"); |
296 | return -EINVAL; | ||
297 | } | ||
294 | 298 | ||
295 | sirfsoc_timer1_irq.irq = irq_of_parse_and_map(np, 1); | 299 | sirfsoc_timer1_irq.irq = irq_of_parse_and_map(np, 1); |
296 | if (!sirfsoc_timer1_irq.irq) | 300 | if (!sirfsoc_timer1_irq.irq) { |
297 | panic("No irq passed for timer1 via DT\n"); | 301 | pr_err("No irq passed for timer1 via DT\n"); |
302 | return -EINVAL; | ||
303 | } | ||
298 | 304 | ||
299 | sirfsoc_atlas7_timer_init(np); | 305 | return sirfsoc_atlas7_timer_init(np); |
300 | } | 306 | } |
301 | CLOCKSOURCE_OF_DECLARE(sirfsoc_atlas7_timer, "sirf,atlas7-tick", sirfsoc_of_timer_init); | 307 | CLOCKSOURCE_OF_DECLARE_RET(sirfsoc_atlas7_timer, "sirf,atlas7-tick", sirfsoc_of_timer_init); |