Эх сурвалжийг харах

CLOCKSOURCE: mips-gic: Enable the clock before using it

For the clock to be used (e.g. get its rate through clk_get_rate)
it should be prepared and enabled first.

Also, while the clock is enabled the driver must hold a reference to it,
so let's remove the call to clk_put.

Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: devicetree@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: James Hartley <James.Hartley@imgtec.com>
Cc: Govindraj Raja <Govindraj.Raja@imgtec.com>
Cc: Damien Horsley <Damien.Horsley@imgtec.com>
Cc: James Hogan <James.Hogan@imgtec.com>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Patchwork: https://patchwork.linux-mips.org/patch/10779/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Ezequiel Garcia 10 жил өмнө
parent
commit
eb811c73b6

+ 6 - 1
drivers/clocksource/mips-gic-timer.c

@@ -158,8 +158,13 @@ static void __init gic_clocksource_of_init(struct device_node *node)
 
 
 	clk = of_clk_get(node, 0);
 	clk = of_clk_get(node, 0);
 	if (!IS_ERR(clk)) {
 	if (!IS_ERR(clk)) {
+		if (clk_prepare_enable(clk) < 0) {
+			pr_err("GIC failed to enable clock\n");
+			clk_put(clk);
+			return;
+		}
+
 		gic_frequency = clk_get_rate(clk);
 		gic_frequency = clk_get_rate(clk);
-		clk_put(clk);
 	} else if (of_property_read_u32(node, "clock-frequency",
 	} else if (of_property_read_u32(node, "clock-frequency",
 					&gic_frequency)) {
 					&gic_frequency)) {
 		pr_err("GIC frequency not specified.\n");
 		pr_err("GIC frequency not specified.\n");