aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-realview/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-realview/clock.c')
-rw-r--r--arch/arm/mach-realview/clock.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
index ec3f7e798623..21325a4da9da 100644
--- a/arch/arm/mach-realview/clock.c
+++ b/arch/arm/mach-realview/clock.c
@@ -14,6 +14,7 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/mutex.h>
17 18
18#include <asm/semaphore.h> 19#include <asm/semaphore.h>
19#include <asm/hardware/icst307.h> 20#include <asm/hardware/icst307.h>
@@ -21,20 +22,20 @@
21#include "clock.h" 22#include "clock.h"
22 23
23static LIST_HEAD(clocks); 24static LIST_HEAD(clocks);
24static DECLARE_MUTEX(clocks_sem); 25static DEFINE_MUTEX(clocks_mutex);
25 26
26struct clk *clk_get(struct device *dev, const char *id) 27struct clk *clk_get(struct device *dev, const char *id)
27{ 28{
28 struct clk *p, *clk = ERR_PTR(-ENOENT); 29 struct clk *p, *clk = ERR_PTR(-ENOENT);
29 30
30 down(&clocks_sem); 31 mutex_lock(&clocks_mutex);
31 list_for_each_entry(p, &clocks, node) { 32 list_for_each_entry(p, &clocks, node) {
32 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
33 clk = p; 34 clk = p;
34 break; 35 break;
35 } 36 }
36 } 37 }
37 up(&clocks_sem); 38 mutex_unlock(&clocks_mutex);
38 39
39 return clk; 40 return clk;
40} 41}
@@ -109,18 +110,18 @@ static struct clk mmci_clk = {
109 110
110int clk_register(struct clk *clk) 111int clk_register(struct clk *clk)
111{ 112{
112 down(&clocks_sem); 113 mutex_lock(&clocks_mutex);
113 list_add(&clk->node, &clocks); 114 list_add(&clk->node, &clocks);
114 up(&clocks_sem); 115 mutex_unlock(&clocks_mutex);
115 return 0; 116 return 0;
116} 117}
117EXPORT_SYMBOL(clk_register); 118EXPORT_SYMBOL(clk_register);
118 119
119void clk_unregister(struct clk *clk) 120void clk_unregister(struct clk *clk)
120{ 121{
121 down(&clocks_sem); 122 mutex_lock(&clocks_mutex);
122 list_del(&clk->node); 123 list_del(&clk->node);
123 up(&clocks_sem); 124 mutex_unlock(&clocks_mutex);
124} 125}
125EXPORT_SYMBOL(clk_unregister); 126EXPORT_SYMBOL(clk_unregister);
126 127