Thread (22 messages) 22 messages, 4 authors, 2012-04-25
STALE5194d
Revisions (5)
  1. v1 [diff vs current]
  2. v1 current
  3. v1 [diff vs current]
  4. v1 [diff vs current]
  5. v2 [diff vs current]

[PATCH 2/8] clk: mxs: add clock support for imx23

From: Turquette, Mike <hidden>
Date: 2012-04-23 23:07:13

On Sat, Apr 21, 2012 at 8:57 AM, Shawn Guo [off-list ref] wrote:
Add imx23 clock support based on common clk framework.

Signed-off-by: Shawn Guo <redacted>
---
...
+int __init mx23_clocks_init(void)
+{
+ ? ? ? struct clk *clk;
+ ? ? ? int ret;
+
+ ? ? ? clk_misc_init();
+
+ ? ? ? mxs_clk_fixed("ref_xtal", 24000000);
There is no error checking at all?
quoted hunk ↗ jump to hunk
diff --git a/drivers/clk/mxs/clk.h b/drivers/clk/mxs/clk.h
index deb5c23..fb5937d 100644
--- a/drivers/clk/mxs/clk.h
+++ b/drivers/clk/mxs/clk.h
@@ -12,6 +12,8 @@
?#ifndef __MXS_CLK_H
?#define __MXS_CLK_H

+#include <linux/clk.h>
+#include <linux/clkdev.h>
?#include <linux/clk-provider.h>
?#include <linux/err.h>
?#include <linux/io.h>
@@ -72,4 +74,22 @@ static inline int mxs_clk_wait(void __iomem *reg, u8 shift)
? ? ? ?return 0;
?}

+static inline int mxs_clk_init_on(char **clks_init_on, int num)
+{
+ ? ? ? struct clk *clk;
+ ? ? ? int i;
+
+ ? ? ? for (i = 0; i < num; i++) {
+ ? ? ? ? ? ? ? clk = clk_get_sys(clks_init_on[i], NULL);
+ ? ? ? ? ? ? ? if (IS_ERR(clk)) {
+ ? ? ? ? ? ? ? ? ? ? ? pr_err("%s: failed to get clk %s", __func__,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?clks_init_on[i]);
+ ? ? ? ? ? ? ? ? ? ? ? return PTR_ERR(clk);
+ ? ? ? ? ? ? ? }
+ ? ? ? ? ? ? ? clk_prepare_enable(clk);
+ ? ? ? }
+
+ ? ? ? return 0;
+}
Any good reason for this code to live in the header as static inline?

Do you call this code any time other than at boot?  Why not __init?

Thanks,
Mike
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help