diff options
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r-- | arch/arm/mach-sa1100/clock.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index b1e8fd766c1a..fc97fe57ee6f 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c | |||
@@ -9,14 +9,17 @@ | |||
9 | #include <linux/string.h> | 9 | #include <linux/string.h> |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
12 | #include <linux/mutex.h> | ||
12 | 13 | ||
13 | #include <asm/hardware.h> | 14 | #include <asm/hardware.h> |
14 | #include <asm/semaphore.h> | ||
15 | 15 | ||
16 | /* | ||
17 | * Very simple clock implementation - we only have one clock to | ||
18 | * deal with at the moment, so we only match using the "name". | ||
19 | */ | ||
16 | struct clk { | 20 | struct clk { |
17 | struct list_head node; | 21 | struct list_head node; |
18 | unsigned long rate; | 22 | unsigned long rate; |
19 | struct module *owner; | ||
20 | const char *name; | 23 | const char *name; |
21 | unsigned int enabled; | 24 | unsigned int enabled; |
22 | void (*enable)(void); | 25 | void (*enable)(void); |
@@ -24,21 +27,21 @@ struct clk { | |||
24 | }; | 27 | }; |
25 | 28 | ||
26 | static LIST_HEAD(clocks); | 29 | static LIST_HEAD(clocks); |
27 | static DECLARE_MUTEX(clocks_sem); | 30 | static DEFINE_MUTEX(clocks_mutex); |
28 | static DEFINE_SPINLOCK(clocks_lock); | 31 | static DEFINE_SPINLOCK(clocks_lock); |
29 | 32 | ||
30 | struct clk *clk_get(struct device *dev, const char *id) | 33 | struct clk *clk_get(struct device *dev, const char *id) |
31 | { | 34 | { |
32 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 35 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
33 | 36 | ||
34 | down(&clocks_sem); | 37 | mutex_lock(&clocks_mutex); |
35 | list_for_each_entry(p, &clocks, node) { | 38 | list_for_each_entry(p, &clocks, node) { |
36 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 39 | if (strcmp(id, p->name) == 0) { |
37 | clk = p; | 40 | clk = p; |
38 | break; | 41 | break; |
39 | } | 42 | } |
40 | } | 43 | } |
41 | up(&clocks_sem); | 44 | mutex_unlock(&clocks_mutex); |
42 | 45 | ||
43 | return clk; | 46 | return clk; |
44 | } | 47 | } |
@@ -46,7 +49,6 @@ EXPORT_SYMBOL(clk_get); | |||
46 | 49 | ||
47 | void clk_put(struct clk *clk) | 50 | void clk_put(struct clk *clk) |
48 | { | 51 | { |
49 | module_put(clk->owner); | ||
50 | } | 52 | } |
51 | EXPORT_SYMBOL(clk_put); | 53 | EXPORT_SYMBOL(clk_put); |
52 | 54 | ||
@@ -109,18 +111,18 @@ static struct clk clk_gpio27 = { | |||
109 | 111 | ||
110 | int clk_register(struct clk *clk) | 112 | int clk_register(struct clk *clk) |
111 | { | 113 | { |
112 | down(&clocks_sem); | 114 | mutex_lock(&clocks_mutex); |
113 | list_add(&clk->node, &clocks); | 115 | list_add(&clk->node, &clocks); |
114 | up(&clocks_sem); | 116 | mutex_unlock(&clocks_mutex); |
115 | return 0; | 117 | return 0; |
116 | } | 118 | } |
117 | EXPORT_SYMBOL(clk_register); | 119 | EXPORT_SYMBOL(clk_register); |
118 | 120 | ||
119 | void clk_unregister(struct clk *clk) | 121 | void clk_unregister(struct clk *clk) |
120 | { | 122 | { |
121 | down(&clocks_sem); | 123 | mutex_lock(&clocks_mutex); |
122 | list_del(&clk->node); | 124 | list_del(&clk->node); |
123 | up(&clocks_sem); | 125 | mutex_unlock(&clocks_mutex); |
124 | } | 126 | } |
125 | EXPORT_SYMBOL(clk_unregister); | 127 | EXPORT_SYMBOL(clk_unregister); |
126 | 128 | ||