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/i386/kernel | |
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/i386/kernel')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 9 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/mtrr/main.c | 13 | ||||
-rw-r--r-- | arch/i386/kernel/microcode.c | 7 |
3 files changed, 16 insertions, 13 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index e5bc06480ff9..1e70823e1cb5 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #ifdef CONFIG_X86_POWERNOW_K8_ACPI | 41 | #ifdef CONFIG_X86_POWERNOW_K8_ACPI |
42 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
43 | #include <linux/mutex.h> | ||
43 | #include <acpi/processor.h> | 44 | #include <acpi/processor.h> |
44 | #endif | 45 | #endif |
45 | 46 | ||
@@ -49,7 +50,7 @@ | |||
49 | #include "powernow-k8.h" | 50 | #include "powernow-k8.h" |
50 | 51 | ||
51 | /* serialize freq changes */ | 52 | /* serialize freq changes */ |
52 | static DECLARE_MUTEX(fidvid_sem); | 53 | static DEFINE_MUTEX(fidvid_mutex); |
53 | 54 | ||
54 | static struct powernow_k8_data *powernow_data[NR_CPUS]; | 55 | static struct powernow_k8_data *powernow_data[NR_CPUS]; |
55 | 56 | ||
@@ -943,17 +944,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
943 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) | 944 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) |
944 | goto err_out; | 945 | goto err_out; |
945 | 946 | ||
946 | down(&fidvid_sem); | 947 | mutex_lock(&fidvid_mutex); |
947 | 948 | ||
948 | powernow_k8_acpi_pst_values(data, newstate); | 949 | powernow_k8_acpi_pst_values(data, newstate); |
949 | 950 | ||
950 | if (transition_frequency(data, newstate)) { | 951 | if (transition_frequency(data, newstate)) { |
951 | printk(KERN_ERR PFX "transition frequency failed\n"); | 952 | printk(KERN_ERR PFX "transition frequency failed\n"); |
952 | ret = 1; | 953 | ret = 1; |
953 | up(&fidvid_sem); | 954 | mutex_unlock(&fidvid_mutex); |
954 | goto err_out; | 955 | goto err_out; |
955 | } | 956 | } |
956 | up(&fidvid_sem); | 957 | mutex_unlock(&fidvid_mutex); |
957 | 958 | ||
958 | pol->cur = find_khz_freq_from_fid(data->currfid); | 959 | pol->cur = find_khz_freq_from_fid(data->currfid); |
959 | ret = 0; | 960 | ret = 0; |
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c index 3b4618bed70d..fff90bda4733 100644 --- a/arch/i386/kernel/cpu/mtrr/main.c +++ b/arch/i386/kernel/cpu/mtrr/main.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | #include <linux/smp.h> | 37 | #include <linux/smp.h> |
38 | #include <linux/cpu.h> | 38 | #include <linux/cpu.h> |
39 | #include <linux/mutex.h> | ||
39 | 40 | ||
40 | #include <asm/mtrr.h> | 41 | #include <asm/mtrr.h> |
41 | 42 | ||
@@ -47,7 +48,7 @@ | |||
47 | u32 num_var_ranges = 0; | 48 | u32 num_var_ranges = 0; |
48 | 49 | ||
49 | unsigned int *usage_table; | 50 | unsigned int *usage_table; |
50 | static DECLARE_MUTEX(mtrr_sem); | 51 | static DEFINE_MUTEX(mtrr_mutex); |
51 | 52 | ||
52 | u32 size_or_mask, size_and_mask; | 53 | u32 size_or_mask, size_and_mask; |
53 | 54 | ||
@@ -333,7 +334,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, | |||
333 | /* No CPU hotplug when we change MTRR entries */ | 334 | /* No CPU hotplug when we change MTRR entries */ |
334 | lock_cpu_hotplug(); | 335 | lock_cpu_hotplug(); |
335 | /* Search for existing MTRR */ | 336 | /* Search for existing MTRR */ |
336 | down(&mtrr_sem); | 337 | mutex_lock(&mtrr_mutex); |
337 | for (i = 0; i < num_var_ranges; ++i) { | 338 | for (i = 0; i < num_var_ranges; ++i) { |
338 | mtrr_if->get(i, &lbase, &lsize, <ype); | 339 | mtrr_if->get(i, &lbase, &lsize, <ype); |
339 | if (base >= lbase + lsize) | 340 | if (base >= lbase + lsize) |
@@ -371,7 +372,7 @@ int mtrr_add_page(unsigned long base, unsigned long size, | |||
371 | printk(KERN_INFO "mtrr: no more MTRRs available\n"); | 372 | printk(KERN_INFO "mtrr: no more MTRRs available\n"); |
372 | error = i; | 373 | error = i; |
373 | out: | 374 | out: |
374 | up(&mtrr_sem); | 375 | mutex_unlock(&mtrr_mutex); |
375 | unlock_cpu_hotplug(); | 376 | unlock_cpu_hotplug(); |
376 | return error; | 377 | return error; |
377 | } | 378 | } |
@@ -464,7 +465,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) | |||
464 | max = num_var_ranges; | 465 | max = num_var_ranges; |
465 | /* No CPU hotplug when we change MTRR entries */ | 466 | /* No CPU hotplug when we change MTRR entries */ |
466 | lock_cpu_hotplug(); | 467 | lock_cpu_hotplug(); |
467 | down(&mtrr_sem); | 468 | mutex_lock(&mtrr_mutex); |
468 | if (reg < 0) { | 469 | if (reg < 0) { |
469 | /* Search for existing MTRR */ | 470 | /* Search for existing MTRR */ |
470 | for (i = 0; i < max; ++i) { | 471 | for (i = 0; i < max; ++i) { |
@@ -503,7 +504,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) | |||
503 | set_mtrr(reg, 0, 0, 0); | 504 | set_mtrr(reg, 0, 0, 0); |
504 | error = reg; | 505 | error = reg; |
505 | out: | 506 | out: |
506 | up(&mtrr_sem); | 507 | mutex_unlock(&mtrr_mutex); |
507 | unlock_cpu_hotplug(); | 508 | unlock_cpu_hotplug(); |
508 | return error; | 509 | return error; |
509 | } | 510 | } |
@@ -685,7 +686,7 @@ void mtrr_ap_init(void) | |||
685 | if (!mtrr_if || !use_intel()) | 686 | if (!mtrr_if || !use_intel()) |
686 | return; | 687 | return; |
687 | /* | 688 | /* |
688 | * Ideally we should hold mtrr_sem here to avoid mtrr entries changed, | 689 | * Ideally we should hold mtrr_mutex here to avoid mtrr entries changed, |
689 | * but this routine will be called in cpu boot time, holding the lock | 690 | * but this routine will be called in cpu boot time, holding the lock |
690 | * breaks it. This routine is called in two cases: 1.very earily time | 691 | * breaks it. This routine is called in two cases: 1.very earily time |
691 | * of software resume, when there absolutely isn't mtrr entry changes; | 692 | * of software resume, when there absolutely isn't mtrr entry changes; |
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index 55bc365b8753..dd780a00553f 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <linux/miscdevice.h> | 81 | #include <linux/miscdevice.h> |
82 | #include <linux/spinlock.h> | 82 | #include <linux/spinlock.h> |
83 | #include <linux/mm.h> | 83 | #include <linux/mm.h> |
84 | #include <linux/mutex.h> | ||
84 | 85 | ||
85 | #include <asm/msr.h> | 86 | #include <asm/msr.h> |
86 | #include <asm/uaccess.h> | 87 | #include <asm/uaccess.h> |
@@ -114,7 +115,7 @@ MODULE_LICENSE("GPL"); | |||
114 | static DEFINE_SPINLOCK(microcode_update_lock); | 115 | static DEFINE_SPINLOCK(microcode_update_lock); |
115 | 116 | ||
116 | /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ | 117 | /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ |
117 | static DECLARE_MUTEX(microcode_sem); | 118 | static DEFINE_MUTEX(microcode_mutex); |
118 | 119 | ||
119 | static void __user *user_buffer; /* user area microcode data buffer */ | 120 | static void __user *user_buffer; /* user area microcode data buffer */ |
120 | static unsigned int user_buffer_size; /* it's size */ | 121 | static unsigned int user_buffer_size; /* it's size */ |
@@ -444,7 +445,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_ | |||
444 | return -EINVAL; | 445 | return -EINVAL; |
445 | } | 446 | } |
446 | 447 | ||
447 | down(µcode_sem); | 448 | mutex_lock(µcode_mutex); |
448 | 449 | ||
449 | user_buffer = (void __user *) buf; | 450 | user_buffer = (void __user *) buf; |
450 | user_buffer_size = (int) len; | 451 | user_buffer_size = (int) len; |
@@ -453,7 +454,7 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_ | |||
453 | if (!ret) | 454 | if (!ret) |
454 | ret = (ssize_t)len; | 455 | ret = (ssize_t)len; |
455 | 456 | ||
456 | up(µcode_sem); | 457 | mutex_unlock(µcode_mutex); |
457 | 458 | ||
458 | return ret; | 459 | return ret; |
459 | } | 460 | } |