aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2007-04-22 05:08:58 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-04-22 05:08:58 -0400
commitd0a9d75b9cd9cc8097c746611cc57cc8438b94be (patch)
tree32684a761660f0f68681da6994534065c22a2a3b
parent235b185ce47ce64793362bd3ae4bcd8afc6b57b8 (diff)
[ARM] sa1100: use mutexes rather than semaphores
Use a mutex in the sa1100 clock support rather than a semaphore. Remove the unused "module" field. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-sa1100/clock.c24
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 */
16struct clk { 20struct 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
26static LIST_HEAD(clocks); 29static LIST_HEAD(clocks);
27static DECLARE_MUTEX(clocks_sem); 30static DEFINE_MUTEX(clocks_mutex);
28static DEFINE_SPINLOCK(clocks_lock); 31static DEFINE_SPINLOCK(clocks_lock);
29 32
30struct clk *clk_get(struct device *dev, const char *id) 33struct 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
47void clk_put(struct clk *clk) 50void clk_put(struct clk *clk)
48{ 51{
49 module_put(clk->owner);
50} 52}
51EXPORT_SYMBOL(clk_put); 53EXPORT_SYMBOL(clk_put);
52 54
@@ -109,18 +111,18 @@ static struct clk clk_gpio27 = {
109 111
110int clk_register(struct clk *clk) 112int 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}
117EXPORT_SYMBOL(clk_register); 119EXPORT_SYMBOL(clk_register);
118 120
119void clk_unregister(struct clk *clk) 121void 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}
125EXPORT_SYMBOL(clk_unregister); 127EXPORT_SYMBOL(clk_unregister);
126 128