Commit 326e31ee authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Daniel Lezcano

clocksource: Put nodes passed to CLOCKSOURCE_OF_DECLARE callbacks centrally

Instead of letting each driver call of_node_put do it centrally in the
loop that also calls the CLOCKSOURCE_OF_DECLARE callbacks. This is less
prone to error and also moves getting and putting the references into the
same function.

Consequently all respective of_node_put calls in drivers are removed.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: default avatarDavid Brown <davidb@codeaurora.org>
parent fa94bd57
...@@ -274,7 +274,6 @@ static void __init msm_dt_timer_init(struct device_node *np) ...@@ -274,7 +274,6 @@ static void __init msm_dt_timer_init(struct device_node *np)
pr_err("Unknown frequency\n"); pr_err("Unknown frequency\n");
return; return;
} }
of_node_put(np);
event_base = base + 0x4; event_base = base + 0x4;
sts_base = base + 0x88; sts_base = base + 0x88;
......
...@@ -32,5 +32,6 @@ void __init clocksource_of_init(void) ...@@ -32,5 +32,6 @@ void __init clocksource_of_init(void)
for_each_matching_node_and_match(np, __clksrc_of_table, &match) { for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
init_func = match->data; init_func = match->data;
init_func(np); init_func(np);
of_node_put(np);
} }
} }
...@@ -138,12 +138,10 @@ static void __init dw_apb_timer_init(struct device_node *timer) ...@@ -138,12 +138,10 @@ static void __init dw_apb_timer_init(struct device_node *timer)
case 0: case 0:
pr_debug("%s: found clockevent timer\n", __func__); pr_debug("%s: found clockevent timer\n", __func__);
add_clockevent(timer); add_clockevent(timer);
of_node_put(timer);
break; break;
case 1: case 1:
pr_debug("%s: found clocksource timer\n", __func__); pr_debug("%s: found clocksource timer\n", __func__);
add_clocksource(timer); add_clocksource(timer);
of_node_put(timer);
init_sched_clock(); init_sched_clock();
break; break;
default: default:
......
...@@ -181,8 +181,6 @@ static void __init tegra20_init_timer(struct device_node *np) ...@@ -181,8 +181,6 @@ static void __init tegra20_init_timer(struct device_node *np)
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
} }
of_node_put(np);
switch (rate) { switch (rate) {
case 12000000: case 12000000:
timer_writel(0x000b, TIMERUS_USEC_CFG); timer_writel(0x000b, TIMERUS_USEC_CFG);
...@@ -241,8 +239,6 @@ static void __init tegra20_init_rtc(struct device_node *np) ...@@ -241,8 +239,6 @@ static void __init tegra20_init_rtc(struct device_node *np)
else else
clk_prepare_enable(clk); clk_prepare_enable(clk);
of_node_put(np);
register_persistent_clock(NULL, tegra_read_persistent_clock); register_persistent_clock(NULL, tegra_read_persistent_clock);
} }
CLOCKSOURCE_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc); CLOCKSOURCE_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc);
......
...@@ -137,14 +137,12 @@ static void __init vt8500_timer_init(struct device_node *np) ...@@ -137,14 +137,12 @@ static void __init vt8500_timer_init(struct device_node *np)
if (!regbase) { if (!regbase) {
pr_err("%s: Missing iobase description in Device Tree\n", pr_err("%s: Missing iobase description in Device Tree\n",
__func__); __func__);
of_node_put(np);
return; return;
} }
timer_irq = irq_of_parse_and_map(np, 0); timer_irq = irq_of_parse_and_map(np, 0);
if (!timer_irq) { if (!timer_irq) {
pr_err("%s: Missing irq description in Device Tree\n", pr_err("%s: Missing irq description in Device Tree\n",
__func__); __func__);
of_node_put(np);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment