diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-26 04:37:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:56:55 -0500 |
commit | 14cc3e2b633bb64063698980974df4535368e98f (patch) | |
tree | d542c9db7376de199d640b8e34d5630460b217b5 /arch/powerpc | |
parent | 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (diff) |
[PATCH] sem2mutex: misc static one-file mutexes
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jens Axboe <axboe@suse.de>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Cc: Greg KH <greg@kroah.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/mm/imalloc.c | 18 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 22 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/cpufreq_64.c | 7 |
3 files changed, 24 insertions, 23 deletions
diff --git a/arch/powerpc/mm/imalloc.c b/arch/powerpc/mm/imalloc.c index 8b0c132bc163..add8c1a9af68 100644 --- a/arch/powerpc/mm/imalloc.c +++ b/arch/powerpc/mm/imalloc.c | |||
@@ -13,12 +13,12 @@ | |||
13 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
14 | #include <asm/pgalloc.h> | 14 | #include <asm/pgalloc.h> |
15 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
16 | #include <asm/semaphore.h> | 16 | #include <linux/mutex.h> |
17 | #include <asm/cacheflush.h> | 17 | #include <asm/cacheflush.h> |
18 | 18 | ||
19 | #include "mmu_decl.h" | 19 | #include "mmu_decl.h" |
20 | 20 | ||
21 | static DECLARE_MUTEX(imlist_sem); | 21 | static DEFINE_MUTEX(imlist_mutex); |
22 | struct vm_struct * imlist = NULL; | 22 | struct vm_struct * imlist = NULL; |
23 | 23 | ||
24 | static int get_free_im_addr(unsigned long size, unsigned long *im_addr) | 24 | static int get_free_im_addr(unsigned long size, unsigned long *im_addr) |
@@ -257,7 +257,7 @@ struct vm_struct * im_get_free_area(unsigned long size) | |||
257 | struct vm_struct *area; | 257 | struct vm_struct *area; |
258 | unsigned long addr; | 258 | unsigned long addr; |
259 | 259 | ||
260 | down(&imlist_sem); | 260 | mutex_lock(&imlist_mutex); |
261 | if (get_free_im_addr(size, &addr)) { | 261 | if (get_free_im_addr(size, &addr)) { |
262 | printk(KERN_ERR "%s() cannot obtain addr for size 0x%lx\n", | 262 | printk(KERN_ERR "%s() cannot obtain addr for size 0x%lx\n", |
263 | __FUNCTION__, size); | 263 | __FUNCTION__, size); |
@@ -272,7 +272,7 @@ struct vm_struct * im_get_free_area(unsigned long size) | |||
272 | __FUNCTION__, addr, size); | 272 | __FUNCTION__, addr, size); |
273 | } | 273 | } |
274 | next_im_done: | 274 | next_im_done: |
275 | up(&imlist_sem); | 275 | mutex_unlock(&imlist_mutex); |
276 | return area; | 276 | return area; |
277 | } | 277 | } |
278 | 278 | ||
@@ -281,9 +281,9 @@ struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size, | |||
281 | { | 281 | { |
282 | struct vm_struct *area; | 282 | struct vm_struct *area; |
283 | 283 | ||
284 | down(&imlist_sem); | 284 | mutex_lock(&imlist_mutex); |
285 | area = __im_get_area(v_addr, size, criteria); | 285 | area = __im_get_area(v_addr, size, criteria); |
286 | up(&imlist_sem); | 286 | mutex_unlock(&imlist_mutex); |
287 | return area; | 287 | return area; |
288 | } | 288 | } |
289 | 289 | ||
@@ -297,17 +297,17 @@ void im_free(void * addr) | |||
297 | printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr); | 297 | printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr); |
298 | return; | 298 | return; |
299 | } | 299 | } |
300 | down(&imlist_sem); | 300 | mutex_lock(&imlist_mutex); |
301 | for (p = &imlist ; (tmp = *p) ; p = &tmp->next) { | 301 | for (p = &imlist ; (tmp = *p) ; p = &tmp->next) { |
302 | if (tmp->addr == addr) { | 302 | if (tmp->addr == addr) { |
303 | *p = tmp->next; | 303 | *p = tmp->next; |
304 | unmap_vm_area(tmp); | 304 | unmap_vm_area(tmp); |
305 | kfree(tmp); | 305 | kfree(tmp); |
306 | up(&imlist_sem); | 306 | mutex_unlock(&imlist_mutex); |
307 | return; | 307 | return; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | up(&imlist_sem); | 310 | mutex_unlock(&imlist_mutex); |
311 | printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__, | 311 | printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__, |
312 | addr); | 312 | addr); |
313 | } | 313 | } |
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index d75ae03df686..a8fa1eeeb174 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include <asm/io.h> | 33 | #include <asm/io.h> |
34 | #include <asm/prom.h> | 34 | #include <asm/prom.h> |
35 | #include <asm/semaphore.h> | 35 | #include <linux/mutex.h> |
36 | #include <asm/spu.h> | 36 | #include <asm/spu.h> |
37 | #include <asm/mmu_context.h> | 37 | #include <asm/mmu_context.h> |
38 | 38 | ||
@@ -342,7 +342,7 @@ spu_free_irqs(struct spu *spu) | |||
342 | } | 342 | } |
343 | 343 | ||
344 | static LIST_HEAD(spu_list); | 344 | static LIST_HEAD(spu_list); |
345 | static DECLARE_MUTEX(spu_mutex); | 345 | static DEFINE_MUTEX(spu_mutex); |
346 | 346 | ||
347 | static void spu_init_channels(struct spu *spu) | 347 | static void spu_init_channels(struct spu *spu) |
348 | { | 348 | { |
@@ -382,7 +382,7 @@ struct spu *spu_alloc(void) | |||
382 | { | 382 | { |
383 | struct spu *spu; | 383 | struct spu *spu; |
384 | 384 | ||
385 | down(&spu_mutex); | 385 | mutex_lock(&spu_mutex); |
386 | if (!list_empty(&spu_list)) { | 386 | if (!list_empty(&spu_list)) { |
387 | spu = list_entry(spu_list.next, struct spu, list); | 387 | spu = list_entry(spu_list.next, struct spu, list); |
388 | list_del_init(&spu->list); | 388 | list_del_init(&spu->list); |
@@ -391,7 +391,7 @@ struct spu *spu_alloc(void) | |||
391 | pr_debug("No SPU left\n"); | 391 | pr_debug("No SPU left\n"); |
392 | spu = NULL; | 392 | spu = NULL; |
393 | } | 393 | } |
394 | up(&spu_mutex); | 394 | mutex_unlock(&spu_mutex); |
395 | 395 | ||
396 | if (spu) | 396 | if (spu) |
397 | spu_init_channels(spu); | 397 | spu_init_channels(spu); |
@@ -402,9 +402,9 @@ EXPORT_SYMBOL_GPL(spu_alloc); | |||
402 | 402 | ||
403 | void spu_free(struct spu *spu) | 403 | void spu_free(struct spu *spu) |
404 | { | 404 | { |
405 | down(&spu_mutex); | 405 | mutex_lock(&spu_mutex); |
406 | list_add_tail(&spu->list, &spu_list); | 406 | list_add_tail(&spu->list, &spu_list); |
407 | up(&spu_mutex); | 407 | mutex_unlock(&spu_mutex); |
408 | } | 408 | } |
409 | EXPORT_SYMBOL_GPL(spu_free); | 409 | EXPORT_SYMBOL_GPL(spu_free); |
410 | 410 | ||
@@ -633,14 +633,14 @@ static int __init create_spu(struct device_node *spe) | |||
633 | spu->wbox_callback = NULL; | 633 | spu->wbox_callback = NULL; |
634 | spu->stop_callback = NULL; | 634 | spu->stop_callback = NULL; |
635 | 635 | ||
636 | down(&spu_mutex); | 636 | mutex_lock(&spu_mutex); |
637 | spu->number = number++; | 637 | spu->number = number++; |
638 | ret = spu_request_irqs(spu); | 638 | ret = spu_request_irqs(spu); |
639 | if (ret) | 639 | if (ret) |
640 | goto out_unmap; | 640 | goto out_unmap; |
641 | 641 | ||
642 | list_add(&spu->list, &spu_list); | 642 | list_add(&spu->list, &spu_list); |
643 | up(&spu_mutex); | 643 | mutex_unlock(&spu_mutex); |
644 | 644 | ||
645 | pr_debug(KERN_DEBUG "Using SPE %s %02x %p %p %p %p %d\n", | 645 | pr_debug(KERN_DEBUG "Using SPE %s %02x %p %p %p %p %d\n", |
646 | spu->name, spu->isrc, spu->local_store, | 646 | spu->name, spu->isrc, spu->local_store, |
@@ -648,7 +648,7 @@ static int __init create_spu(struct device_node *spe) | |||
648 | goto out; | 648 | goto out; |
649 | 649 | ||
650 | out_unmap: | 650 | out_unmap: |
651 | up(&spu_mutex); | 651 | mutex_unlock(&spu_mutex); |
652 | spu_unmap(spu); | 652 | spu_unmap(spu); |
653 | out_free: | 653 | out_free: |
654 | kfree(spu); | 654 | kfree(spu); |
@@ -668,10 +668,10 @@ static void destroy_spu(struct spu *spu) | |||
668 | static void cleanup_spu_base(void) | 668 | static void cleanup_spu_base(void) |
669 | { | 669 | { |
670 | struct spu *spu, *tmp; | 670 | struct spu *spu, *tmp; |
671 | down(&spu_mutex); | 671 | mutex_lock(&spu_mutex); |
672 | list_for_each_entry_safe(spu, tmp, &spu_list, list) | 672 | list_for_each_entry_safe(spu, tmp, &spu_list, list) |
673 | destroy_spu(spu); | 673 | destroy_spu(spu); |
674 | up(&spu_mutex); | 674 | mutex_unlock(&spu_mutex); |
675 | } | 675 | } |
676 | module_exit(cleanup_spu_base); | 676 | module_exit(cleanup_spu_base); |
677 | 677 | ||
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index a415e8d2f7af..b57e465a1b71 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/cpufreq.h> | 21 | #include <linux/cpufreq.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
24 | #include <linux/mutex.h> | ||
24 | #include <asm/prom.h> | 25 | #include <asm/prom.h> |
25 | #include <asm/machdep.h> | 26 | #include <asm/machdep.h> |
26 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
@@ -90,7 +91,7 @@ static void (*g5_switch_volt)(int speed_mode); | |||
90 | static int (*g5_switch_freq)(int speed_mode); | 91 | static int (*g5_switch_freq)(int speed_mode); |
91 | static int (*g5_query_freq)(void); | 92 | static int (*g5_query_freq)(void); |
92 | 93 | ||
93 | static DECLARE_MUTEX(g5_switch_mutex); | 94 | static DEFINE_MUTEX(g5_switch_mutex); |
94 | 95 | ||
95 | 96 | ||
96 | static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ | 97 | static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ |
@@ -327,7 +328,7 @@ static int g5_cpufreq_target(struct cpufreq_policy *policy, | |||
327 | if (g5_pmode_cur == newstate) | 328 | if (g5_pmode_cur == newstate) |
328 | return 0; | 329 | return 0; |
329 | 330 | ||
330 | down(&g5_switch_mutex); | 331 | mutex_lock(&g5_switch_mutex); |
331 | 332 | ||
332 | freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; | 333 | freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; |
333 | freqs.new = g5_cpu_freqs[newstate].frequency; | 334 | freqs.new = g5_cpu_freqs[newstate].frequency; |
@@ -337,7 +338,7 @@ static int g5_cpufreq_target(struct cpufreq_policy *policy, | |||
337 | rc = g5_switch_freq(newstate); | 338 | rc = g5_switch_freq(newstate); |
338 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 339 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
339 | 340 | ||
340 | up(&g5_switch_mutex); | 341 | mutex_unlock(&g5_switch_mutex); |
341 | 342 | ||
342 | return rc; | 343 | return rc; |
343 | } | 344 | } |