diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-12 13:42:23 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-01-12 13:42:23 -0500 |
commit | 00431707be0cc1236ee08459367872b57da5be29 (patch) | |
tree | 0a57cbf54f1fcc9ef2852e68e96c3b99e1b903d8 /arch/arm | |
parent | f4619025a51747a3788fd1bb6bdc46e368a889a7 (diff) |
[ARM] Convert some arm semaphores to mutexes
The arm clock semaphores are strict mutexes, convert them to the new
mutex implementation
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/common/rtctime.c | 15 | ||||
-rw-r--r-- | arch/arm/kernel/ecard.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-aaec2000/clock.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-integrator/clock.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-pxa/ssp.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-realview/clock.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/clock.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-versatile/clock.c | 15 | ||||
-rw-r--r-- | arch/arm/plat-omap/clock.c | 15 |
9 files changed, 67 insertions, 58 deletions
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c index 72b03f201eb9..00f6278f42b8 100644 --- a/arch/arm/common/rtctime.c +++ b/arch/arm/common/rtctime.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/mutex.h> | ||
21 | 22 | ||
22 | #include <asm/rtc.h> | 23 | #include <asm/rtc.h> |
23 | #include <asm/semaphore.h> | 24 | #include <asm/semaphore.h> |
@@ -34,7 +35,7 @@ static unsigned long rtc_irq_data; | |||
34 | /* | 35 | /* |
35 | * rtc_sem protects rtc_inuse and rtc_ops | 36 | * rtc_sem protects rtc_inuse and rtc_ops |
36 | */ | 37 | */ |
37 | static DECLARE_MUTEX(rtc_sem); | 38 | static DEFINE_MUTEX(rtc_mutex); |
38 | static unsigned long rtc_inuse; | 39 | static unsigned long rtc_inuse; |
39 | static struct rtc_ops *rtc_ops; | 40 | static struct rtc_ops *rtc_ops; |
40 | 41 | ||
@@ -355,7 +356,7 @@ static int rtc_open(struct inode *inode, struct file *file) | |||
355 | { | 356 | { |
356 | int ret; | 357 | int ret; |
357 | 358 | ||
358 | down(&rtc_sem); | 359 | mutex_lock(&rtc_mutex); |
359 | 360 | ||
360 | if (rtc_inuse) { | 361 | if (rtc_inuse) { |
361 | ret = -EBUSY; | 362 | ret = -EBUSY; |
@@ -373,7 +374,7 @@ static int rtc_open(struct inode *inode, struct file *file) | |||
373 | rtc_inuse = 1; | 374 | rtc_inuse = 1; |
374 | } | 375 | } |
375 | } | 376 | } |
376 | up(&rtc_sem); | 377 | mutex_unlock(&rtc_mutex); |
377 | 378 | ||
378 | return ret; | 379 | return ret; |
379 | } | 380 | } |
@@ -479,7 +480,7 @@ int register_rtc(struct rtc_ops *ops) | |||
479 | { | 480 | { |
480 | int ret = -EBUSY; | 481 | int ret = -EBUSY; |
481 | 482 | ||
482 | down(&rtc_sem); | 483 | mutex_lock(&rtc_mutex); |
483 | if (rtc_ops == NULL) { | 484 | if (rtc_ops == NULL) { |
484 | rtc_ops = ops; | 485 | rtc_ops = ops; |
485 | 486 | ||
@@ -488,7 +489,7 @@ int register_rtc(struct rtc_ops *ops) | |||
488 | create_proc_read_entry("driver/rtc", 0, NULL, | 489 | create_proc_read_entry("driver/rtc", 0, NULL, |
489 | rtc_read_proc, ops); | 490 | rtc_read_proc, ops); |
490 | } | 491 | } |
491 | up(&rtc_sem); | 492 | mutex_unlock(&rtc_mutex); |
492 | 493 | ||
493 | return ret; | 494 | return ret; |
494 | } | 495 | } |
@@ -496,12 +497,12 @@ EXPORT_SYMBOL(register_rtc); | |||
496 | 497 | ||
497 | void unregister_rtc(struct rtc_ops *rtc) | 498 | void unregister_rtc(struct rtc_ops *rtc) |
498 | { | 499 | { |
499 | down(&rtc_sem); | 500 | mutex_lock(&rtc_mutex); |
500 | if (rtc == rtc_ops) { | 501 | if (rtc == rtc_ops) { |
501 | remove_proc_entry("driver/rtc", NULL); | 502 | remove_proc_entry("driver/rtc", NULL); |
502 | misc_deregister(&rtc_miscdev); | 503 | misc_deregister(&rtc_miscdev); |
503 | rtc_ops = NULL; | 504 | rtc_ops = NULL; |
504 | } | 505 | } |
505 | up(&rtc_sem); | 506 | mutex_unlock(&rtc_mutex); |
506 | } | 507 | } |
507 | EXPORT_SYMBOL(unregister_rtc); | 508 | EXPORT_SYMBOL(unregister_rtc); |
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index dceb826bd216..96fd91926c9b 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
41 | #include <linux/device.h> | 41 | #include <linux/device.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/mutex.h> | ||
43 | 44 | ||
44 | #include <asm/dma.h> | 45 | #include <asm/dma.h> |
45 | #include <asm/ecard.h> | 46 | #include <asm/ecard.h> |
@@ -206,7 +207,7 @@ static void ecard_task_readbytes(struct ecard_request *req) | |||
206 | 207 | ||
207 | static DECLARE_WAIT_QUEUE_HEAD(ecard_wait); | 208 | static DECLARE_WAIT_QUEUE_HEAD(ecard_wait); |
208 | static struct ecard_request *ecard_req; | 209 | static struct ecard_request *ecard_req; |
209 | static DECLARE_MUTEX(ecard_sem); | 210 | static DEFINE_MUTEX(ecard_mutex); |
210 | 211 | ||
211 | /* | 212 | /* |
212 | * Set up the expansion card daemon's page tables. | 213 | * Set up the expansion card daemon's page tables. |
@@ -299,7 +300,7 @@ static void ecard_call(struct ecard_request *req) | |||
299 | 300 | ||
300 | req->complete = &completion; | 301 | req->complete = &completion; |
301 | 302 | ||
302 | down(&ecard_sem); | 303 | mutex_lock(&ecard_mutex); |
303 | ecard_req = req; | 304 | ecard_req = req; |
304 | wake_up(&ecard_wait); | 305 | wake_up(&ecard_wait); |
305 | 306 | ||
@@ -307,7 +308,7 @@ static void ecard_call(struct ecard_request *req) | |||
307 | * Now wait for kecardd to run. | 308 | * Now wait for kecardd to run. |
308 | */ | 309 | */ |
309 | wait_for_completion(&completion); | 310 | wait_for_completion(&completion); |
310 | up(&ecard_sem); | 311 | mutex_unlock(&ecard_mutex); |
311 | } | 312 | } |
312 | 313 | ||
313 | /* ======================= Mid-level card control ===================== */ | 314 | /* ======================= Mid-level card control ===================== */ |
diff --git a/arch/arm/mach-aaec2000/clock.c b/arch/arm/mach-aaec2000/clock.c index 1c84c60941e1..74aa7a39bb68 100644 --- a/arch/arm/mach-aaec2000/clock.c +++ b/arch/arm/mach-aaec2000/clock.c | |||
@@ -16,26 +16,27 @@ | |||
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/mutex.h> | ||
19 | 20 | ||
20 | #include <asm/semaphore.h> | 21 | #include <asm/semaphore.h> |
21 | 22 | ||
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 | } |
@@ -78,18 +79,18 @@ EXPORT_SYMBOL(clk_set_rate); | |||
78 | 79 | ||
79 | int clk_register(struct clk *clk) | 80 | int clk_register(struct clk *clk) |
80 | { | 81 | { |
81 | down(&clocks_sem); | 82 | mutex_lock(&clocks_mutex); |
82 | list_add(&clk->node, &clocks); | 83 | list_add(&clk->node, &clocks); |
83 | up(&clocks_sem); | 84 | mutex_unlock(&clocks_mutex); |
84 | return 0; | 85 | return 0; |
85 | } | 86 | } |
86 | EXPORT_SYMBOL(clk_register); | 87 | EXPORT_SYMBOL(clk_register); |
87 | 88 | ||
88 | void clk_unregister(struct clk *clk) | 89 | void clk_unregister(struct clk *clk) |
89 | { | 90 | { |
90 | down(&clocks_sem); | 91 | mutex_lock(&clocks_mutex); |
91 | list_del(&clk->node); | 92 | list_del(&clk->node); |
92 | up(&clocks_sem); | 93 | mutex_unlock(&clocks_mutex); |
93 | } | 94 | } |
94 | EXPORT_SYMBOL(clk_unregister); | 95 | EXPORT_SYMBOL(clk_unregister); |
95 | 96 | ||
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/mach-integrator/clock.c index 40684e01e865..95a1e263f7fa 100644 --- a/arch/arm/mach-integrator/clock.c +++ b/arch/arm/mach-integrator/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/icst525.h> | 21 | #include <asm/hardware/icst525.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 | } |
@@ -107,18 +108,18 @@ static struct clk uart_clk = { | |||
107 | 108 | ||
108 | int clk_register(struct clk *clk) | 109 | int clk_register(struct clk *clk) |
109 | { | 110 | { |
110 | down(&clocks_sem); | 111 | mutex_lock(&clocks_mutex); |
111 | list_add(&clk->node, &clocks); | 112 | list_add(&clk->node, &clocks); |
112 | up(&clocks_sem); | 113 | mutex_unlock(&clocks_mutex); |
113 | return 0; | 114 | return 0; |
114 | } | 115 | } |
115 | EXPORT_SYMBOL(clk_register); | 116 | EXPORT_SYMBOL(clk_register); |
116 | 117 | ||
117 | void clk_unregister(struct clk *clk) | 118 | void clk_unregister(struct clk *clk) |
118 | { | 119 | { |
119 | down(&clocks_sem); | 120 | mutex_lock(&clocks_mutex); |
120 | list_del(&clk->node); | 121 | list_del(&clk->node); |
121 | up(&clocks_sem); | 122 | mutex_unlock(&clocks_mutex); |
122 | } | 123 | } |
123 | EXPORT_SYMBOL(clk_unregister); | 124 | EXPORT_SYMBOL(clk_unregister); |
124 | 125 | ||
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c index a68b30eff4d2..93096befd017 100644 --- a/arch/arm/mach-pxa/ssp.c +++ b/arch/arm/mach-pxa/ssp.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/ioport.h> | 32 | #include <linux/ioport.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/mutex.h> | ||
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
36 | #include <asm/hardware.h> | 37 | #include <asm/hardware.h> |
@@ -59,7 +60,7 @@ static const struct ssp_info_ ssp_info[PXA_SSP_PORTS] = { | |||
59 | #endif | 60 | #endif |
60 | }; | 61 | }; |
61 | 62 | ||
62 | static DECLARE_MUTEX(sem); | 63 | static DEFINE_MUTEX(mutex); |
63 | static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; | 64 | static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; |
64 | 65 | ||
65 | static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 66 | static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
@@ -239,16 +240,16 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) | |||
239 | if (port > PXA_SSP_PORTS || port == 0) | 240 | if (port > PXA_SSP_PORTS || port == 0) |
240 | return -ENODEV; | 241 | return -ENODEV; |
241 | 242 | ||
242 | down(&sem); | 243 | mutex_lock(&mutex); |
243 | if (use_count[port - 1]) { | 244 | if (use_count[port - 1]) { |
244 | up(&sem); | 245 | mutex_unlock(&mutex); |
245 | return -EBUSY; | 246 | return -EBUSY; |
246 | } | 247 | } |
247 | use_count[port - 1]++; | 248 | use_count[port - 1]++; |
248 | 249 | ||
249 | if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { | 250 | if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { |
250 | use_count[port - 1]--; | 251 | use_count[port - 1]--; |
251 | up(&sem); | 252 | mutex_unlock(&mutex); |
252 | return -EBUSY; | 253 | return -EBUSY; |
253 | } | 254 | } |
254 | dev->port = port; | 255 | dev->port = port; |
@@ -265,13 +266,13 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) | |||
265 | 266 | ||
266 | /* turn on SSP port clock */ | 267 | /* turn on SSP port clock */ |
267 | pxa_set_cken(ssp_info[port-1].clock, 1); | 268 | pxa_set_cken(ssp_info[port-1].clock, 1); |
268 | up(&sem); | 269 | mutex_unlock(&mutex); |
269 | return 0; | 270 | return 0; |
270 | 271 | ||
271 | out_region: | 272 | out_region: |
272 | release_mem_region(__PREG(SSCR0_P(port)), 0x2c); | 273 | release_mem_region(__PREG(SSCR0_P(port)), 0x2c); |
273 | use_count[port - 1]--; | 274 | use_count[port - 1]--; |
274 | up(&sem); | 275 | mutex_unlock(&mutex); |
275 | return ret; | 276 | return ret; |
276 | } | 277 | } |
277 | 278 | ||
@@ -282,7 +283,7 @@ out_region: | |||
282 | */ | 283 | */ |
283 | void ssp_exit(struct ssp_dev *dev) | 284 | void ssp_exit(struct ssp_dev *dev) |
284 | { | 285 | { |
285 | down(&sem); | 286 | mutex_lock(&mutex); |
286 | SSCR0_P(dev->port) &= ~SSCR0_SSE; | 287 | SSCR0_P(dev->port) &= ~SSCR0_SSE; |
287 | 288 | ||
288 | if (dev->port > PXA_SSP_PORTS || dev->port == 0) { | 289 | if (dev->port > PXA_SSP_PORTS || dev->port == 0) { |
@@ -295,7 +296,7 @@ void ssp_exit(struct ssp_dev *dev) | |||
295 | free_irq(dev->irq, dev); | 296 | free_irq(dev->irq, dev); |
296 | release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); | 297 | release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); |
297 | use_count[dev->port - 1]--; | 298 | use_count[dev->port - 1]--; |
298 | up(&sem); | 299 | mutex_unlock(&mutex); |
299 | } | 300 | } |
300 | 301 | ||
301 | EXPORT_SYMBOL(ssp_write_word); | 302 | EXPORT_SYMBOL(ssp_write_word); |
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 | ||
23 | static LIST_HEAD(clocks); | 24 | static LIST_HEAD(clocks); |
24 | static DECLARE_MUTEX(clocks_sem); | 25 | static DEFINE_MUTEX(clocks_mutex); |
25 | 26 | ||
26 | struct clk *clk_get(struct device *dev, const char *id) | 27 | struct 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 | ||
110 | int clk_register(struct clk *clk) | 111 | int 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 | } |
117 | EXPORT_SYMBOL(clk_register); | 118 | EXPORT_SYMBOL(clk_register); |
118 | 119 | ||
119 | void clk_unregister(struct clk *clk) | 120 | void 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 | } |
125 | EXPORT_SYMBOL(clk_unregister); | 126 | EXPORT_SYMBOL(clk_unregister); |
126 | 127 | ||
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c index fc09ba92d66a..af2f3d52b61b 100644 --- a/arch/arm/mach-s3c2410/clock.c +++ b/arch/arm/mach-s3c2410/clock.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/ioport.h> | 38 | #include <linux/ioport.h> |
39 | #include <linux/clk.h> | 39 | #include <linux/clk.h> |
40 | #include <linux/mutex.h> | ||
40 | 41 | ||
41 | #include <asm/hardware.h> | 42 | #include <asm/hardware.h> |
42 | #include <asm/atomic.h> | 43 | #include <asm/atomic.h> |
@@ -51,7 +52,7 @@ | |||
51 | /* clock information */ | 52 | /* clock information */ |
52 | 53 | ||
53 | static LIST_HEAD(clocks); | 54 | static LIST_HEAD(clocks); |
54 | static DECLARE_MUTEX(clocks_sem); | 55 | static DEFINE_MUTEX(clocks_mutex); |
55 | 56 | ||
56 | /* old functions */ | 57 | /* old functions */ |
57 | 58 | ||
@@ -102,7 +103,7 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
102 | else | 103 | else |
103 | idno = to_platform_device(dev)->id; | 104 | idno = to_platform_device(dev)->id; |
104 | 105 | ||
105 | down(&clocks_sem); | 106 | mutex_lock(&clocks_mutex); |
106 | 107 | ||
107 | list_for_each_entry(p, &clocks, list) { | 108 | list_for_each_entry(p, &clocks, list) { |
108 | if (p->id == idno && | 109 | if (p->id == idno && |
@@ -126,7 +127,7 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
126 | } | 127 | } |
127 | } | 128 | } |
128 | 129 | ||
129 | up(&clocks_sem); | 130 | mutex_unlock(&clocks_mutex); |
130 | return clk; | 131 | return clk; |
131 | } | 132 | } |
132 | 133 | ||
@@ -362,9 +363,9 @@ int s3c24xx_register_clock(struct clk *clk) | |||
362 | 363 | ||
363 | /* add to the list of available clocks */ | 364 | /* add to the list of available clocks */ |
364 | 365 | ||
365 | down(&clocks_sem); | 366 | mutex_lock(&clocks_mutex); |
366 | list_add(&clk->list, &clocks); | 367 | list_add(&clk->list, &clocks); |
367 | up(&clocks_sem); | 368 | mutex_unlock(&clocks_mutex); |
368 | 369 | ||
369 | return 0; | 370 | return 0; |
370 | } | 371 | } |
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 | ||
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 84fd65656fcf..7ebc5a29db8d 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/mutex.h> | ||
23 | 24 | ||
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/semaphore.h> | 26 | #include <asm/semaphore.h> |
@@ -27,7 +28,7 @@ | |||
27 | #include <asm/arch/clock.h> | 28 | #include <asm/arch/clock.h> |
28 | 29 | ||
29 | LIST_HEAD(clocks); | 30 | LIST_HEAD(clocks); |
30 | static DECLARE_MUTEX(clocks_sem); | 31 | static DEFINE_MUTEX(clocks_mutex); |
31 | DEFINE_SPINLOCK(clockfw_lock); | 32 | DEFINE_SPINLOCK(clockfw_lock); |
32 | 33 | ||
33 | static struct clk_functions *arch_clock; | 34 | static struct clk_functions *arch_clock; |
@@ -40,14 +41,14 @@ struct clk * clk_get(struct device *dev, const char *id) | |||
40 | { | 41 | { |
41 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 42 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
42 | 43 | ||
43 | down(&clocks_sem); | 44 | mutex_lock(&clocks_mutex); |
44 | list_for_each_entry(p, &clocks, node) { | 45 | list_for_each_entry(p, &clocks, node) { |
45 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { | 46 | if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { |
46 | clk = p; | 47 | clk = p; |
47 | break; | 48 | break; |
48 | } | 49 | } |
49 | } | 50 | } |
50 | up(&clocks_sem); | 51 | mutex_unlock(&clocks_mutex); |
51 | 52 | ||
52 | return clk; | 53 | return clk; |
53 | } | 54 | } |
@@ -249,11 +250,11 @@ void propagate_rate(struct clk * tclk) | |||
249 | 250 | ||
250 | int clk_register(struct clk *clk) | 251 | int clk_register(struct clk *clk) |
251 | { | 252 | { |
252 | down(&clocks_sem); | 253 | mutex_lock(&clocks_mutex); |
253 | list_add(&clk->node, &clocks); | 254 | list_add(&clk->node, &clocks); |
254 | if (clk->init) | 255 | if (clk->init) |
255 | clk->init(clk); | 256 | clk->init(clk); |
256 | up(&clocks_sem); | 257 | mutex_unlock(&clocks_mutex); |
257 | 258 | ||
258 | return 0; | 259 | return 0; |
259 | } | 260 | } |
@@ -261,9 +262,9 @@ EXPORT_SYMBOL(clk_register); | |||
261 | 262 | ||
262 | void clk_unregister(struct clk *clk) | 263 | void clk_unregister(struct clk *clk) |
263 | { | 264 | { |
264 | down(&clocks_sem); | 265 | mutex_lock(&clocks_mutex); |
265 | list_del(&clk->node); | 266 | list_del(&clk->node); |
266 | up(&clocks_sem); | 267 | mutex_unlock(&clocks_mutex); |
267 | } | 268 | } |
268 | EXPORT_SYMBOL(clk_unregister); | 269 | EXPORT_SYMBOL(clk_unregister); |
269 | 270 | ||