diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2011-02-23 20:37:42 +0300 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2011-02-28 23:40:17 +0300 |
commit | bd32344a6baa8baac9c2b3e9c6c649cc4ed53920 (patch) | |
tree | 0b272cc0ea1e7dae1d86fd5ea43de78264000eac /arch/arm/mach-msm/clock.c | |
parent | 2a52220c89e02423aa23e6b9fb6dc0c706465a82 (diff) | |
download | linux-bd32344a6baa8baac9c2b3e9c6c649cc4ed53920.tar.xz |
msm: clock: Migrate to clkdev
Migrating to clkdev has several advantages:
* Less code in mach-msm/clock.c
* A more robust clk_get() implementation
* clk_add_alias() support
* clk_get_sys() support
In general, this will help board authors setup clock aliases and
break the dependency on device pointers in the clock tables.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm/clock.c')
-rw-r--r-- | arch/arm/mach-msm/clock.c | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c index e00f6a040ad5..22a537669624 100644 --- a/arch/arm/mach-msm/clock.c +++ b/arch/arm/mach-msm/clock.c @@ -19,6 +19,11 @@ #include <linux/err.h> #include <linux/spinlock.h> #include <linux/pm_qos_params.h> +#include <linux/mutex.h> +#include <linux/clk.h> +#include <linux/string.h> +#include <linux/module.h> +#include <linux/clkdev.h> #include "clock.h" @@ -29,32 +34,6 @@ static LIST_HEAD(clocks); /* * Standard clock functions defined in include/linux/clk.h */ -struct clk *clk_get(struct device *dev, const char *id) -{ - struct clk *clk; - - mutex_lock(&clocks_mutex); - - list_for_each_entry(clk, &clocks, list) - if (!strcmp(id, clk->name) && clk->dev == dev) - goto found_it; - - list_for_each_entry(clk, &clocks, list) - if (!strcmp(id, clk->name) && clk->dev == NULL) - goto found_it; - - clk = ERR_PTR(-ENOENT); -found_it: - mutex_unlock(&clocks_mutex); - return clk; -} -EXPORT_SYMBOL(clk_get); - -void clk_put(struct clk *clk) -{ -} -EXPORT_SYMBOL(clk_put); - int clk_enable(struct clk *clk) { unsigned long flags; @@ -157,13 +136,15 @@ EXPORT_SYMBOL(clk_set_flags); */ static struct clk *ebi1_clk; -void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks) +void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks) { unsigned n; mutex_lock(&clocks_mutex); - for (n = 0; n < num_clocks; n++) - list_add_tail(&clock_tbl[n].list, &clocks); + for (n = 0; n < num_clocks; n++) { + clkdev_add(&clock_tbl[n]); + list_add_tail(&clock_tbl[n].clk->list, &clocks); + } mutex_unlock(&clocks_mutex); ebi1_clk = clk_get(NULL, "ebi1_clk"); |