From 497e0488cdf7579e2bd84685d36f4696e60ae453 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Wed, 21 Sep 2005 11:37:10 +0300 Subject: [PATCH] ARM: OMAP: Fixed clock compile for CONFIG_OMAP_RESET_CLOCKS, more locking Fixed clock compile for CONFIG_OMAP_RESET_CLOCKS, more locking --- arch/arm/mach-omap1/clock.c | 2 +- arch/arm/plat-omap/clock.c | 59 +++++++++++++++++++++++++------ include/asm-arm/arch-omap/clock.h | 1 + 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 3e2b546a9ef..3d88de5e8fa 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c @@ -641,7 +641,7 @@ static int __init omap1_late_clk_reset(void) return 0; } -late_initcall(omap_late_clk_reset); +late_initcall(omap1_late_clk_reset); #else #define omap1_early_clk_reset() {} diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 61ac4a790c5..c4a6d1c4cdf 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c @@ -20,7 +20,7 @@ #include -static LIST_HEAD(clocks); +LIST_HEAD(clocks); static DECLARE_MUTEX(clocks_sem); static DEFINE_SPINLOCK(clockfw_lock); @@ -55,6 +55,7 @@ int clk_enable(struct clk *clk) spin_lock_irqsave(&clockfw_lock, flags); ret = clk->enable(clk); spin_unlock_irqrestore(&clockfw_lock, flags); + return ret; } EXPORT_SYMBOL(clk_enable); @@ -78,6 +79,7 @@ int clk_use(struct clk *clk) if (arch_clock->clk_use) ret = arch_clock->clk_use(clk); spin_unlock_irqrestore(&clockfw_lock, flags); + return ret; } EXPORT_SYMBOL(clk_use); @@ -95,13 +97,27 @@ EXPORT_SYMBOL(clk_unuse); int clk_get_usecount(struct clk *clk) { - return clk->usecount; + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&clockfw_lock, flags); + ret = clk->usecount; + spin_unlock_irqrestore(&clockfw_lock, flags); + + return ret; } EXPORT_SYMBOL(clk_get_usecount); unsigned long clk_get_rate(struct clk *clk) { - return clk->rate; + unsigned long flags; + unsigned long ret = 0; + + spin_lock_irqsave(&clockfw_lock, flags); + ret = clk->rate; + spin_unlock_irqrestore(&clockfw_lock, flags); + + return ret; } EXPORT_SYMBOL(clk_get_rate); @@ -118,37 +134,57 @@ EXPORT_SYMBOL(clk_put); long clk_round_rate(struct clk *clk, unsigned long rate) { + unsigned long flags; + long ret = 0; + + spin_lock_irqsave(&clockfw_lock, flags); if (arch_clock->clk_round_rate) - return arch_clock->clk_round_rate(clk, rate); + ret = arch_clock->clk_round_rate(clk, rate); + spin_unlock_irqrestore(&clockfw_lock, flags); - return 0; + return ret; } EXPORT_SYMBOL(clk_round_rate); int clk_set_rate(struct clk *clk, unsigned long rate) { + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&clockfw_lock, flags); if (arch_clock->clk_set_rate) - return arch_clock->clk_set_rate(clk, rate); + ret = arch_clock->clk_set_rate(clk, rate); + spin_unlock_irqrestore(&clockfw_lock, flags); - return 0; + return ret; } EXPORT_SYMBOL(clk_set_rate); int clk_set_parent(struct clk *clk, struct clk *parent) { + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(&clockfw_lock, flags); if (arch_clock->clk_set_parent) - return arch_clock->clk_set_parent(clk, parent); + ret = arch_clock->clk_set_parent(clk, parent); + spin_unlock_irqrestore(&clockfw_lock, flags); - return 0; + return ret; } EXPORT_SYMBOL(clk_set_parent); struct clk *clk_get_parent(struct clk *clk) { + unsigned long flags; + struct clk * ret = NULL; + + spin_lock_irqsave(&clockfw_lock, flags); if (arch_clock->clk_get_parent) - return arch_clock->clk_get_parent(clk); + ret = arch_clock->clk_get_parent(clk); + spin_unlock_irqrestore(&clockfw_lock, flags); - return 0; + return ret; } EXPORT_SYMBOL(clk_get_parent); @@ -181,6 +217,7 @@ int clk_register(struct clk *clk) if (clk->init) clk->init(clk); up(&clocks_sem); + return 0; } EXPORT_SYMBOL(clk_register); diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h index a4e8042ccdf..589a097524d 100644 --- a/include/asm-arm/arch-omap/clock.h +++ b/include/asm-arm/arch-omap/clock.h @@ -47,6 +47,7 @@ struct clk_functions { }; extern spinlock_t clockfw_lock; +extern struct list_head clocks; extern int clk_init(struct clk_functions * custom_clocks); extern int clk_register(struct clk *clk); -- 2.41.1