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