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 | |
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>
-rw-r--r-- | arch/arm26/kernel/traps.c | 12 | ||||
-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 | ||||
-rw-r--r-- | arch/mips/lasat/sysctl.c | 63 | ||||
-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 | ||||
-rw-r--r-- | drivers/macintosh/smu.c | 9 | ||||
-rw-r--r-- | drivers/md/kcopyd.c | 16 | ||||
-rw-r--r-- | drivers/net/wan/dscc4.c | 7 | ||||
-rw-r--r-- | drivers/parport/share.c | 19 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpadlpar_core.c | 12 | ||||
-rw-r--r-- | drivers/pci/hotplug/sgi_hotplug.c | 19 | ||||
-rw-r--r-- | drivers/pnp/isapnp/core.c | 7 | ||||
-rw-r--r-- | drivers/s390/char/raw3270.c | 39 | ||||
-rw-r--r-- | drivers/telephony/phonedev.c | 21 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 11 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_hashlimit.c | 9 | ||||
-rw-r--r-- | net/netlink/genetlink.c | 9 |
20 files changed, 172 insertions, 157 deletions
diff --git a/arch/arm26/kernel/traps.c b/arch/arm26/kernel/traps.c index 5847ea5d7747..a79de041b50e 100644 --- a/arch/arm26/kernel/traps.c +++ b/arch/arm26/kernel/traps.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
36 | #include <asm/unistd.h> | 36 | #include <asm/unistd.h> |
37 | #include <asm/semaphore.h> | 37 | #include <linux/mutex.h> |
38 | 38 | ||
39 | #include "ptrace.h" | 39 | #include "ptrace.h" |
40 | 40 | ||
@@ -207,19 +207,19 @@ void die_if_kernel(const char *str, struct pt_regs *regs, int err) | |||
207 | die(str, regs, err); | 207 | die(str, regs, err); |
208 | } | 208 | } |
209 | 209 | ||
210 | static DECLARE_MUTEX(undef_sem); | 210 | static DEFINE_MUTEX(undef_mutex); |
211 | static int (*undef_hook)(struct pt_regs *); | 211 | static int (*undef_hook)(struct pt_regs *); |
212 | 212 | ||
213 | int request_undef_hook(int (*fn)(struct pt_regs *)) | 213 | int request_undef_hook(int (*fn)(struct pt_regs *)) |
214 | { | 214 | { |
215 | int ret = -EBUSY; | 215 | int ret = -EBUSY; |
216 | 216 | ||
217 | down(&undef_sem); | 217 | mutex_lock(&undef_mutex); |
218 | if (undef_hook == NULL) { | 218 | if (undef_hook == NULL) { |
219 | undef_hook = fn; | 219 | undef_hook = fn; |
220 | ret = 0; | 220 | ret = 0; |
221 | } | 221 | } |
222 | up(&undef_sem); | 222 | mutex_unlock(&undef_mutex); |
223 | 223 | ||
224 | return ret; | 224 | return ret; |
225 | } | 225 | } |
@@ -228,12 +228,12 @@ int release_undef_hook(int (*fn)(struct pt_regs *)) | |||
228 | { | 228 | { |
229 | int ret = -EINVAL; | 229 | int ret = -EINVAL; |
230 | 230 | ||
231 | down(&undef_sem); | 231 | mutex_lock(&undef_mutex); |
232 | if (undef_hook == fn) { | 232 | if (undef_hook == fn) { |
233 | undef_hook = NULL; | 233 | undef_hook = NULL; |
234 | ret = 0; | 234 | ret = 0; |
235 | } | 235 | } |
236 | up(&undef_sem); | 236 | mutex_unlock(&undef_mutex); |
237 | 237 | ||
238 | return ret; | 238 | return ret; |
239 | } | 239 | } |
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 | } |
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c index 8ff43a1c1e99..e3d5aaa90f0d 100644 --- a/arch/mips/lasat/sysctl.c +++ b/arch/mips/lasat/sysctl.c | |||
@@ -30,12 +30,13 @@ | |||
30 | #include <linux/string.h> | 30 | #include <linux/string.h> |
31 | #include <linux/net.h> | 31 | #include <linux/net.h> |
32 | #include <linux/inet.h> | 32 | #include <linux/inet.h> |
33 | #include <linux/mutex.h> | ||
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
34 | 35 | ||
35 | #include "sysctl.h" | 36 | #include "sysctl.h" |
36 | #include "ds1603.h" | 37 | #include "ds1603.h" |
37 | 38 | ||
38 | static DECLARE_MUTEX(lasat_info_sem); | 39 | static DEFINE_MUTEX(lasat_info_mutex); |
39 | 40 | ||
40 | /* Strategy function to write EEPROM after changing string entry */ | 41 | /* Strategy function to write EEPROM after changing string entry */ |
41 | int sysctl_lasatstring(ctl_table *table, int *name, int nlen, | 42 | int sysctl_lasatstring(ctl_table *table, int *name, int nlen, |
@@ -43,17 +44,17 @@ int sysctl_lasatstring(ctl_table *table, int *name, int nlen, | |||
43 | void *newval, size_t newlen, void **context) | 44 | void *newval, size_t newlen, void **context) |
44 | { | 45 | { |
45 | int r; | 46 | int r; |
46 | down(&lasat_info_sem); | 47 | mutex_lock(&lasat_info_mutex); |
47 | r = sysctl_string(table, name, | 48 | r = sysctl_string(table, name, |
48 | nlen, oldval, oldlenp, newval, newlen, context); | 49 | nlen, oldval, oldlenp, newval, newlen, context); |
49 | if (r < 0) { | 50 | if (r < 0) { |
50 | up(&lasat_info_sem); | 51 | mutex_unlock(&lasat_info_mutex); |
51 | return r; | 52 | return r; |
52 | } | 53 | } |
53 | if (newval && newlen) { | 54 | if (newval && newlen) { |
54 | lasat_write_eeprom_info(); | 55 | lasat_write_eeprom_info(); |
55 | } | 56 | } |
56 | up(&lasat_info_sem); | 57 | mutex_unlock(&lasat_info_mutex); |
57 | return 1; | 58 | return 1; |
58 | } | 59 | } |
59 | 60 | ||
@@ -63,14 +64,14 @@ int proc_dolasatstring(ctl_table *table, int write, struct file *filp, | |||
63 | void *buffer, size_t *lenp, loff_t *ppos) | 64 | void *buffer, size_t *lenp, loff_t *ppos) |
64 | { | 65 | { |
65 | int r; | 66 | int r; |
66 | down(&lasat_info_sem); | 67 | mutex_lock(&lasat_info_mutex); |
67 | r = proc_dostring(table, write, filp, buffer, lenp, ppos); | 68 | r = proc_dostring(table, write, filp, buffer, lenp, ppos); |
68 | if ( (!write) || r) { | 69 | if ( (!write) || r) { |
69 | up(&lasat_info_sem); | 70 | mutex_unlock(&lasat_info_mutex); |
70 | return r; | 71 | return r; |
71 | } | 72 | } |
72 | lasat_write_eeprom_info(); | 73 | lasat_write_eeprom_info(); |
73 | up(&lasat_info_sem); | 74 | mutex_unlock(&lasat_info_mutex); |
74 | return 0; | 75 | return 0; |
75 | } | 76 | } |
76 | 77 | ||
@@ -79,14 +80,14 @@ int proc_dolasatint(ctl_table *table, int write, struct file *filp, | |||
79 | void *buffer, size_t *lenp, loff_t *ppos) | 80 | void *buffer, size_t *lenp, loff_t *ppos) |
80 | { | 81 | { |
81 | int r; | 82 | int r; |
82 | down(&lasat_info_sem); | 83 | mutex_lock(&lasat_info_mutex); |
83 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 84 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
84 | if ( (!write) || r) { | 85 | if ( (!write) || r) { |
85 | up(&lasat_info_sem); | 86 | mutex_unlock(&lasat_info_mutex); |
86 | return r; | 87 | return r; |
87 | } | 88 | } |
88 | lasat_write_eeprom_info(); | 89 | lasat_write_eeprom_info(); |
89 | up(&lasat_info_sem); | 90 | mutex_unlock(&lasat_info_mutex); |
90 | return 0; | 91 | return 0; |
91 | } | 92 | } |
92 | 93 | ||
@@ -98,7 +99,7 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp, | |||
98 | void *buffer, size_t *lenp, loff_t *ppos) | 99 | void *buffer, size_t *lenp, loff_t *ppos) |
99 | { | 100 | { |
100 | int r; | 101 | int r; |
101 | down(&lasat_info_sem); | 102 | mutex_lock(&lasat_info_mutex); |
102 | if (!write) { | 103 | if (!write) { |
103 | rtctmp = ds1603_read(); | 104 | rtctmp = ds1603_read(); |
104 | /* check for time < 0 and set to 0 */ | 105 | /* check for time < 0 and set to 0 */ |
@@ -107,11 +108,11 @@ int proc_dolasatrtc(ctl_table *table, int write, struct file *filp, | |||
107 | } | 108 | } |
108 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 109 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
109 | if ( (!write) || r) { | 110 | if ( (!write) || r) { |
110 | up(&lasat_info_sem); | 111 | mutex_unlock(&lasat_info_mutex); |
111 | return r; | 112 | return r; |
112 | } | 113 | } |
113 | ds1603_set(rtctmp); | 114 | ds1603_set(rtctmp); |
114 | up(&lasat_info_sem); | 115 | mutex_unlock(&lasat_info_mutex); |
115 | return 0; | 116 | return 0; |
116 | } | 117 | } |
117 | #endif | 118 | #endif |
@@ -122,16 +123,16 @@ int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen, | |||
122 | void *newval, size_t newlen, void **context) | 123 | void *newval, size_t newlen, void **context) |
123 | { | 124 | { |
124 | int r; | 125 | int r; |
125 | down(&lasat_info_sem); | 126 | mutex_lock(&lasat_info_mutex); |
126 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); | 127 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); |
127 | if (r < 0) { | 128 | if (r < 0) { |
128 | up(&lasat_info_sem); | 129 | mutex_unlock(&lasat_info_mutex); |
129 | return r; | 130 | return r; |
130 | } | 131 | } |
131 | if (newval && newlen) { | 132 | if (newval && newlen) { |
132 | lasat_write_eeprom_info(); | 133 | lasat_write_eeprom_info(); |
133 | } | 134 | } |
134 | up(&lasat_info_sem); | 135 | mutex_unlock(&lasat_info_mutex); |
135 | return 1; | 136 | return 1; |
136 | } | 137 | } |
137 | 138 | ||
@@ -142,19 +143,19 @@ int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen, | |||
142 | void *newval, size_t newlen, void **context) | 143 | void *newval, size_t newlen, void **context) |
143 | { | 144 | { |
144 | int r; | 145 | int r; |
145 | down(&lasat_info_sem); | 146 | mutex_lock(&lasat_info_mutex); |
146 | rtctmp = ds1603_read(); | 147 | rtctmp = ds1603_read(); |
147 | if (rtctmp < 0) | 148 | if (rtctmp < 0) |
148 | rtctmp = 0; | 149 | rtctmp = 0; |
149 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); | 150 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); |
150 | if (r < 0) { | 151 | if (r < 0) { |
151 | up(&lasat_info_sem); | 152 | mutex_unlock(&lasat_info_mutex); |
152 | return r; | 153 | return r; |
153 | } | 154 | } |
154 | if (newval && newlen) { | 155 | if (newval && newlen) { |
155 | ds1603_set(rtctmp); | 156 | ds1603_set(rtctmp); |
156 | } | 157 | } |
157 | up(&lasat_info_sem); | 158 | mutex_unlock(&lasat_info_mutex); |
158 | return 1; | 159 | return 1; |
159 | } | 160 | } |
160 | #endif | 161 | #endif |
@@ -192,13 +193,13 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
192 | return 0; | 193 | return 0; |
193 | } | 194 | } |
194 | 195 | ||
195 | down(&lasat_info_sem); | 196 | mutex_lock(&lasat_info_mutex); |
196 | if (write) { | 197 | if (write) { |
197 | len = 0; | 198 | len = 0; |
198 | p = buffer; | 199 | p = buffer; |
199 | while (len < *lenp) { | 200 | while (len < *lenp) { |
200 | if(get_user(c, p++)) { | 201 | if(get_user(c, p++)) { |
201 | up(&lasat_info_sem); | 202 | mutex_unlock(&lasat_info_mutex); |
202 | return -EFAULT; | 203 | return -EFAULT; |
203 | } | 204 | } |
204 | if (c == 0 || c == '\n') | 205 | if (c == 0 || c == '\n') |
@@ -209,7 +210,7 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
209 | len = sizeof(proc_lasat_ipbuf) - 1; | 210 | len = sizeof(proc_lasat_ipbuf) - 1; |
210 | if (copy_from_user(proc_lasat_ipbuf, buffer, len)) | 211 | if (copy_from_user(proc_lasat_ipbuf, buffer, len)) |
211 | { | 212 | { |
212 | up(&lasat_info_sem); | 213 | mutex_unlock(&lasat_info_mutex); |
213 | return -EFAULT; | 214 | return -EFAULT; |
214 | } | 215 | } |
215 | proc_lasat_ipbuf[len] = 0; | 216 | proc_lasat_ipbuf[len] = 0; |
@@ -230,12 +231,12 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
230 | len = *lenp; | 231 | len = *lenp; |
231 | if (len) | 232 | if (len) |
232 | if(copy_to_user(buffer, proc_lasat_ipbuf, len)) { | 233 | if(copy_to_user(buffer, proc_lasat_ipbuf, len)) { |
233 | up(&lasat_info_sem); | 234 | mutex_unlock(&lasat_info_mutex); |
234 | return -EFAULT; | 235 | return -EFAULT; |
235 | } | 236 | } |
236 | if (len < *lenp) { | 237 | if (len < *lenp) { |
237 | if(put_user('\n', ((char *) buffer) + len)) { | 238 | if(put_user('\n', ((char *) buffer) + len)) { |
238 | up(&lasat_info_sem); | 239 | mutex_unlock(&lasat_info_mutex); |
239 | return -EFAULT; | 240 | return -EFAULT; |
240 | } | 241 | } |
241 | len++; | 242 | len++; |
@@ -244,7 +245,7 @@ int proc_lasat_ip(ctl_table *table, int write, struct file *filp, | |||
244 | *ppos += len; | 245 | *ppos += len; |
245 | } | 246 | } |
246 | update_bcastaddr(); | 247 | update_bcastaddr(); |
247 | up(&lasat_info_sem); | 248 | mutex_unlock(&lasat_info_mutex); |
248 | return 0; | 249 | return 0; |
249 | } | 250 | } |
250 | #endif /* defined(CONFIG_INET) */ | 251 | #endif /* defined(CONFIG_INET) */ |
@@ -256,10 +257,10 @@ static int sysctl_lasat_eeprom_value(ctl_table *table, int *name, int nlen, | |||
256 | { | 257 | { |
257 | int r; | 258 | int r; |
258 | 259 | ||
259 | down(&lasat_info_sem); | 260 | mutex_lock(&lasat_info_mutex); |
260 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); | 261 | r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); |
261 | if (r < 0) { | 262 | if (r < 0) { |
262 | up(&lasat_info_sem); | 263 | mutex_unlock(&lasat_info_mutex); |
263 | return r; | 264 | return r; |
264 | } | 265 | } |
265 | 266 | ||
@@ -271,7 +272,7 @@ static int sysctl_lasat_eeprom_value(ctl_table *table, int *name, int nlen, | |||
271 | lasat_write_eeprom_info(); | 272 | lasat_write_eeprom_info(); |
272 | lasat_init_board_info(); | 273 | lasat_init_board_info(); |
273 | } | 274 | } |
274 | up(&lasat_info_sem); | 275 | mutex_unlock(&lasat_info_mutex); |
275 | 276 | ||
276 | return 0; | 277 | return 0; |
277 | } | 278 | } |
@@ -280,10 +281,10 @@ int proc_lasat_eeprom_value(ctl_table *table, int write, struct file *filp, | |||
280 | void *buffer, size_t *lenp, loff_t *ppos) | 281 | void *buffer, size_t *lenp, loff_t *ppos) |
281 | { | 282 | { |
282 | int r; | 283 | int r; |
283 | down(&lasat_info_sem); | 284 | mutex_lock(&lasat_info_mutex); |
284 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); | 285 | r = proc_dointvec(table, write, filp, buffer, lenp, ppos); |
285 | if ( (!write) || r) { | 286 | if ( (!write) || r) { |
286 | up(&lasat_info_sem); | 287 | mutex_unlock(&lasat_info_mutex); |
287 | return r; | 288 | return r; |
288 | } | 289 | } |
289 | if (filp && filp->f_dentry) | 290 | if (filp && filp->f_dentry) |
@@ -294,7 +295,7 @@ int proc_lasat_eeprom_value(ctl_table *table, int write, struct file *filp, | |||
294 | lasat_board_info.li_eeprom_info.debugaccess = lasat_board_info.li_debugaccess; | 295 | lasat_board_info.li_eeprom_info.debugaccess = lasat_board_info.li_debugaccess; |
295 | } | 296 | } |
296 | lasat_write_eeprom_info(); | 297 | lasat_write_eeprom_info(); |
297 | up(&lasat_info_sem); | 298 | mutex_unlock(&lasat_info_mutex); |
298 | return 0; | 299 | return 0; |
299 | } | 300 | } |
300 | 301 | ||
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 | } |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 4eb05d7143d8..f4516ca7aa3a 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/sysdev.h> | 36 | #include <linux/sysdev.h> |
37 | #include <linux/poll.h> | 37 | #include <linux/poll.h> |
38 | #include <linux/mutex.h> | ||
38 | 39 | ||
39 | #include <asm/byteorder.h> | 40 | #include <asm/byteorder.h> |
40 | #include <asm/io.h> | 41 | #include <asm/io.h> |
@@ -92,7 +93,7 @@ struct smu_device { | |||
92 | * for now, just hard code that | 93 | * for now, just hard code that |
93 | */ | 94 | */ |
94 | static struct smu_device *smu; | 95 | static struct smu_device *smu; |
95 | static DECLARE_MUTEX(smu_part_access); | 96 | static DEFINE_MUTEX(smu_part_access); |
96 | 97 | ||
97 | static void smu_i2c_retry(unsigned long data); | 98 | static void smu_i2c_retry(unsigned long data); |
98 | 99 | ||
@@ -976,11 +977,11 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | |||
976 | 977 | ||
977 | if (interruptible) { | 978 | if (interruptible) { |
978 | int rc; | 979 | int rc; |
979 | rc = down_interruptible(&smu_part_access); | 980 | rc = mutex_lock_interruptible(&smu_part_access); |
980 | if (rc) | 981 | if (rc) |
981 | return ERR_PTR(rc); | 982 | return ERR_PTR(rc); |
982 | } else | 983 | } else |
983 | down(&smu_part_access); | 984 | mutex_lock(&smu_part_access); |
984 | 985 | ||
985 | part = (struct smu_sdbp_header *)get_property(smu->of_node, | 986 | part = (struct smu_sdbp_header *)get_property(smu->of_node, |
986 | pname, size); | 987 | pname, size); |
@@ -990,7 +991,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, | |||
990 | if (part != NULL && size) | 991 | if (part != NULL && size) |
991 | *size = part->len << 2; | 992 | *size = part->len << 2; |
992 | } | 993 | } |
993 | up(&smu_part_access); | 994 | mutex_unlock(&smu_part_access); |
994 | return part; | 995 | return part; |
995 | } | 996 | } |
996 | 997 | ||
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index 8b3515f394a6..0d54e8b7d9de 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c | |||
@@ -590,51 +590,51 @@ static void client_del(struct kcopyd_client *kc) | |||
590 | up(&_client_lock); | 590 | up(&_client_lock); |
591 | } | 591 | } |
592 | 592 | ||
593 | static DECLARE_MUTEX(kcopyd_init_lock); | 593 | static DEFINE_MUTEX(kcopyd_init_lock); |
594 | static int kcopyd_clients = 0; | 594 | static int kcopyd_clients = 0; |
595 | 595 | ||
596 | static int kcopyd_init(void) | 596 | static int kcopyd_init(void) |
597 | { | 597 | { |
598 | int r; | 598 | int r; |
599 | 599 | ||
600 | down(&kcopyd_init_lock); | 600 | mutex_lock(&kcopyd_init_lock); |
601 | 601 | ||
602 | if (kcopyd_clients) { | 602 | if (kcopyd_clients) { |
603 | /* Already initialized. */ | 603 | /* Already initialized. */ |
604 | kcopyd_clients++; | 604 | kcopyd_clients++; |
605 | up(&kcopyd_init_lock); | 605 | mutex_unlock(&kcopyd_init_lock); |
606 | return 0; | 606 | return 0; |
607 | } | 607 | } |
608 | 608 | ||
609 | r = jobs_init(); | 609 | r = jobs_init(); |
610 | if (r) { | 610 | if (r) { |
611 | up(&kcopyd_init_lock); | 611 | mutex_unlock(&kcopyd_init_lock); |
612 | return r; | 612 | return r; |
613 | } | 613 | } |
614 | 614 | ||
615 | _kcopyd_wq = create_singlethread_workqueue("kcopyd"); | 615 | _kcopyd_wq = create_singlethread_workqueue("kcopyd"); |
616 | if (!_kcopyd_wq) { | 616 | if (!_kcopyd_wq) { |
617 | jobs_exit(); | 617 | jobs_exit(); |
618 | up(&kcopyd_init_lock); | 618 | mutex_unlock(&kcopyd_init_lock); |
619 | return -ENOMEM; | 619 | return -ENOMEM; |
620 | } | 620 | } |
621 | 621 | ||
622 | kcopyd_clients++; | 622 | kcopyd_clients++; |
623 | INIT_WORK(&_kcopyd_work, do_work, NULL); | 623 | INIT_WORK(&_kcopyd_work, do_work, NULL); |
624 | up(&kcopyd_init_lock); | 624 | mutex_unlock(&kcopyd_init_lock); |
625 | return 0; | 625 | return 0; |
626 | } | 626 | } |
627 | 627 | ||
628 | static void kcopyd_exit(void) | 628 | static void kcopyd_exit(void) |
629 | { | 629 | { |
630 | down(&kcopyd_init_lock); | 630 | mutex_lock(&kcopyd_init_lock); |
631 | kcopyd_clients--; | 631 | kcopyd_clients--; |
632 | if (!kcopyd_clients) { | 632 | if (!kcopyd_clients) { |
633 | jobs_exit(); | 633 | jobs_exit(); |
634 | destroy_workqueue(_kcopyd_wq); | 634 | destroy_workqueue(_kcopyd_wq); |
635 | _kcopyd_wq = NULL; | 635 | _kcopyd_wq = NULL; |
636 | } | 636 | } |
637 | up(&kcopyd_init_lock); | 637 | mutex_unlock(&kcopyd_init_lock); |
638 | } | 638 | } |
639 | 639 | ||
640 | int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result) | 640 | int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result) |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 1ff5de076d21..4505540e3c59 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -105,6 +105,7 @@ | |||
105 | #include <linux/delay.h> | 105 | #include <linux/delay.h> |
106 | #include <net/syncppp.h> | 106 | #include <net/syncppp.h> |
107 | #include <linux/hdlc.h> | 107 | #include <linux/hdlc.h> |
108 | #include <linux/mutex.h> | ||
108 | 109 | ||
109 | /* Version */ | 110 | /* Version */ |
110 | static const char version[] = "$Id: dscc4.c,v 1.173 2003/09/20 23:55:34 romieu Exp $ for Linux\n"; | 111 | static const char version[] = "$Id: dscc4.c,v 1.173 2003/09/20 23:55:34 romieu Exp $ for Linux\n"; |
@@ -112,7 +113,7 @@ static int debug; | |||
112 | static int quartz; | 113 | static int quartz; |
113 | 114 | ||
114 | #ifdef CONFIG_DSCC4_PCI_RST | 115 | #ifdef CONFIG_DSCC4_PCI_RST |
115 | static DECLARE_MUTEX(dscc4_sem); | 116 | static DEFINE_MUTEX(dscc4_mutex); |
116 | static u32 dscc4_pci_config_store[16]; | 117 | static u32 dscc4_pci_config_store[16]; |
117 | #endif | 118 | #endif |
118 | 119 | ||
@@ -1018,7 +1019,7 @@ static void dscc4_pci_reset(struct pci_dev *pdev, void __iomem *ioaddr) | |||
1018 | { | 1019 | { |
1019 | int i; | 1020 | int i; |
1020 | 1021 | ||
1021 | down(&dscc4_sem); | 1022 | mutex_lock(&dscc4_mutex); |
1022 | for (i = 0; i < 16; i++) | 1023 | for (i = 0; i < 16; i++) |
1023 | pci_read_config_dword(pdev, i << 2, dscc4_pci_config_store + i); | 1024 | pci_read_config_dword(pdev, i << 2, dscc4_pci_config_store + i); |
1024 | 1025 | ||
@@ -1039,7 +1040,7 @@ static void dscc4_pci_reset(struct pci_dev *pdev, void __iomem *ioaddr) | |||
1039 | 1040 | ||
1040 | for (i = 0; i < 16; i++) | 1041 | for (i = 0; i < 16; i++) |
1041 | pci_write_config_dword(pdev, i << 2, dscc4_pci_config_store[i]); | 1042 | pci_write_config_dword(pdev, i << 2, dscc4_pci_config_store[i]); |
1042 | up(&dscc4_sem); | 1043 | mutex_unlock(&dscc4_mutex); |
1043 | } | 1044 | } |
1044 | #else | 1045 | #else |
1045 | #define dscc4_pci_reset(pdev,ioaddr) do {} while (0) | 1046 | #define dscc4_pci_reset(pdev,ioaddr) do {} while (0) |
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index ea62bed6bc83..bbbfd79adbaf 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/kmod.h> | 32 | #include <linux/kmod.h> |
33 | 33 | ||
34 | #include <linux/spinlock.h> | 34 | #include <linux/spinlock.h> |
35 | #include <linux/mutex.h> | ||
35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
36 | 37 | ||
37 | #undef PARPORT_PARANOID | 38 | #undef PARPORT_PARANOID |
@@ -50,7 +51,7 @@ static DEFINE_SPINLOCK(full_list_lock); | |||
50 | 51 | ||
51 | static LIST_HEAD(drivers); | 52 | static LIST_HEAD(drivers); |
52 | 53 | ||
53 | static DECLARE_MUTEX(registration_lock); | 54 | static DEFINE_MUTEX(registration_lock); |
54 | 55 | ||
55 | /* What you can do to a port that's gone away.. */ | 56 | /* What you can do to a port that's gone away.. */ |
56 | static void dead_write_lines (struct parport *p, unsigned char b){} | 57 | static void dead_write_lines (struct parport *p, unsigned char b){} |
@@ -158,11 +159,11 @@ int parport_register_driver (struct parport_driver *drv) | |||
158 | if (list_empty(&portlist)) | 159 | if (list_empty(&portlist)) |
159 | get_lowlevel_driver (); | 160 | get_lowlevel_driver (); |
160 | 161 | ||
161 | down(®istration_lock); | 162 | mutex_lock(®istration_lock); |
162 | list_for_each_entry(port, &portlist, list) | 163 | list_for_each_entry(port, &portlist, list) |
163 | drv->attach(port); | 164 | drv->attach(port); |
164 | list_add(&drv->list, &drivers); | 165 | list_add(&drv->list, &drivers); |
165 | up(®istration_lock); | 166 | mutex_unlock(®istration_lock); |
166 | 167 | ||
167 | return 0; | 168 | return 0; |
168 | } | 169 | } |
@@ -188,11 +189,11 @@ void parport_unregister_driver (struct parport_driver *drv) | |||
188 | { | 189 | { |
189 | struct parport *port; | 190 | struct parport *port; |
190 | 191 | ||
191 | down(®istration_lock); | 192 | mutex_lock(®istration_lock); |
192 | list_del_init(&drv->list); | 193 | list_del_init(&drv->list); |
193 | list_for_each_entry(port, &portlist, list) | 194 | list_for_each_entry(port, &portlist, list) |
194 | drv->detach(port); | 195 | drv->detach(port); |
195 | up(®istration_lock); | 196 | mutex_unlock(®istration_lock); |
196 | } | 197 | } |
197 | 198 | ||
198 | static void free_port (struct parport *port) | 199 | static void free_port (struct parport *port) |
@@ -366,7 +367,7 @@ void parport_announce_port (struct parport *port) | |||
366 | #endif | 367 | #endif |
367 | 368 | ||
368 | parport_proc_register(port); | 369 | parport_proc_register(port); |
369 | down(®istration_lock); | 370 | mutex_lock(®istration_lock); |
370 | spin_lock_irq(&parportlist_lock); | 371 | spin_lock_irq(&parportlist_lock); |
371 | list_add_tail(&port->list, &portlist); | 372 | list_add_tail(&port->list, &portlist); |
372 | for (i = 1; i < 3; i++) { | 373 | for (i = 1; i < 3; i++) { |
@@ -383,7 +384,7 @@ void parport_announce_port (struct parport *port) | |||
383 | if (slave) | 384 | if (slave) |
384 | attach_driver_chain(slave); | 385 | attach_driver_chain(slave); |
385 | } | 386 | } |
386 | up(®istration_lock); | 387 | mutex_unlock(®istration_lock); |
387 | } | 388 | } |
388 | 389 | ||
389 | /** | 390 | /** |
@@ -409,7 +410,7 @@ void parport_remove_port(struct parport *port) | |||
409 | { | 410 | { |
410 | int i; | 411 | int i; |
411 | 412 | ||
412 | down(®istration_lock); | 413 | mutex_lock(®istration_lock); |
413 | 414 | ||
414 | /* Spread the word. */ | 415 | /* Spread the word. */ |
415 | detach_driver_chain (port); | 416 | detach_driver_chain (port); |
@@ -436,7 +437,7 @@ void parport_remove_port(struct parport *port) | |||
436 | } | 437 | } |
437 | spin_unlock(&parportlist_lock); | 438 | spin_unlock(&parportlist_lock); |
438 | 439 | ||
439 | up(®istration_lock); | 440 | mutex_unlock(®istration_lock); |
440 | 441 | ||
441 | parport_proc_unregister(port); | 442 | parport_proc_unregister(port); |
442 | 443 | ||
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index 3eefe2cec72d..46825fee3ae4 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | 20 | ||
21 | #include <asm/pci-bridge.h> | 21 | #include <asm/pci-bridge.h> |
22 | #include <asm/semaphore.h> | 22 | #include <linux/mutex.h> |
23 | #include <asm/rtas.h> | 23 | #include <asm/rtas.h> |
24 | #include <asm/vio.h> | 24 | #include <asm/vio.h> |
25 | 25 | ||
@@ -27,7 +27,7 @@ | |||
27 | #include "rpaphp.h" | 27 | #include "rpaphp.h" |
28 | #include "rpadlpar.h" | 28 | #include "rpadlpar.h" |
29 | 29 | ||
30 | static DECLARE_MUTEX(rpadlpar_sem); | 30 | static DEFINE_MUTEX(rpadlpar_mutex); |
31 | 31 | ||
32 | #define DLPAR_MODULE_NAME "rpadlpar_io" | 32 | #define DLPAR_MODULE_NAME "rpadlpar_io" |
33 | 33 | ||
@@ -300,7 +300,7 @@ int dlpar_add_slot(char *drc_name) | |||
300 | int node_type; | 300 | int node_type; |
301 | int rc = -EIO; | 301 | int rc = -EIO; |
302 | 302 | ||
303 | if (down_interruptible(&rpadlpar_sem)) | 303 | if (mutex_lock_interruptible(&rpadlpar_mutex)) |
304 | return -ERESTARTSYS; | 304 | return -ERESTARTSYS; |
305 | 305 | ||
306 | /* Find newly added node */ | 306 | /* Find newly added node */ |
@@ -324,7 +324,7 @@ int dlpar_add_slot(char *drc_name) | |||
324 | 324 | ||
325 | printk(KERN_INFO "%s: slot %s added\n", DLPAR_MODULE_NAME, drc_name); | 325 | printk(KERN_INFO "%s: slot %s added\n", DLPAR_MODULE_NAME, drc_name); |
326 | exit: | 326 | exit: |
327 | up(&rpadlpar_sem); | 327 | mutex_unlock(&rpadlpar_mutex); |
328 | return rc; | 328 | return rc; |
329 | } | 329 | } |
330 | 330 | ||
@@ -417,7 +417,7 @@ int dlpar_remove_slot(char *drc_name) | |||
417 | int node_type; | 417 | int node_type; |
418 | int rc = 0; | 418 | int rc = 0; |
419 | 419 | ||
420 | if (down_interruptible(&rpadlpar_sem)) | 420 | if (mutex_lock_interruptible(&rpadlpar_mutex)) |
421 | return -ERESTARTSYS; | 421 | return -ERESTARTSYS; |
422 | 422 | ||
423 | dn = find_dlpar_node(drc_name, &node_type); | 423 | dn = find_dlpar_node(drc_name, &node_type); |
@@ -439,7 +439,7 @@ int dlpar_remove_slot(char *drc_name) | |||
439 | } | 439 | } |
440 | printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name); | 440 | printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name); |
441 | exit: | 441 | exit: |
442 | up(&rpadlpar_sem); | 442 | mutex_unlock(&rpadlpar_mutex); |
443 | return rc; | 443 | return rc; |
444 | } | 444 | } |
445 | 445 | ||
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index c402da8e78ae..8cb9abde736b 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | #include <linux/proc_fs.h> | 16 | #include <linux/proc_fs.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/mutex.h> | ||
18 | 19 | ||
19 | #include <asm/sn/addrs.h> | 20 | #include <asm/sn/addrs.h> |
20 | #include <asm/sn/l1.h> | 21 | #include <asm/sn/l1.h> |
@@ -81,7 +82,7 @@ static struct hotplug_slot_ops sn_hotplug_slot_ops = { | |||
81 | .get_power_status = get_power_status, | 82 | .get_power_status = get_power_status, |
82 | }; | 83 | }; |
83 | 84 | ||
84 | static DECLARE_MUTEX(sn_hotplug_sem); | 85 | static DEFINE_MUTEX(sn_hotplug_mutex); |
85 | 86 | ||
86 | static ssize_t path_show (struct hotplug_slot *bss_hotplug_slot, | 87 | static ssize_t path_show (struct hotplug_slot *bss_hotplug_slot, |
87 | char *buf) | 88 | char *buf) |
@@ -346,7 +347,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
346 | int rc; | 347 | int rc; |
347 | 348 | ||
348 | /* Serialize the Linux PCI infrastructure */ | 349 | /* Serialize the Linux PCI infrastructure */ |
349 | down(&sn_hotplug_sem); | 350 | mutex_lock(&sn_hotplug_mutex); |
350 | 351 | ||
351 | /* | 352 | /* |
352 | * Power-on and initialize the slot in the SN | 353 | * Power-on and initialize the slot in the SN |
@@ -354,7 +355,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
354 | */ | 355 | */ |
355 | rc = sn_slot_enable(bss_hotplug_slot, slot->device_num); | 356 | rc = sn_slot_enable(bss_hotplug_slot, slot->device_num); |
356 | if (rc) { | 357 | if (rc) { |
357 | up(&sn_hotplug_sem); | 358 | mutex_unlock(&sn_hotplug_mutex); |
358 | return rc; | 359 | return rc; |
359 | } | 360 | } |
360 | 361 | ||
@@ -362,7 +363,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
362 | PCI_DEVFN(slot->device_num + 1, 0)); | 363 | PCI_DEVFN(slot->device_num + 1, 0)); |
363 | if (!num_funcs) { | 364 | if (!num_funcs) { |
364 | dev_dbg(slot->pci_bus->self, "no device in slot\n"); | 365 | dev_dbg(slot->pci_bus->self, "no device in slot\n"); |
365 | up(&sn_hotplug_sem); | 366 | mutex_unlock(&sn_hotplug_mutex); |
366 | return -ENODEV; | 367 | return -ENODEV; |
367 | } | 368 | } |
368 | 369 | ||
@@ -402,7 +403,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
402 | if (new_ppb) | 403 | if (new_ppb) |
403 | pci_bus_add_devices(new_bus); | 404 | pci_bus_add_devices(new_bus); |
404 | 405 | ||
405 | up(&sn_hotplug_sem); | 406 | mutex_unlock(&sn_hotplug_mutex); |
406 | 407 | ||
407 | if (rc == 0) | 408 | if (rc == 0) |
408 | dev_dbg(slot->pci_bus->self, | 409 | dev_dbg(slot->pci_bus->self, |
@@ -422,7 +423,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
422 | int rc; | 423 | int rc; |
423 | 424 | ||
424 | /* Acquire update access to the bus */ | 425 | /* Acquire update access to the bus */ |
425 | down(&sn_hotplug_sem); | 426 | mutex_lock(&sn_hotplug_mutex); |
426 | 427 | ||
427 | /* is it okay to bring this slot down? */ | 428 | /* is it okay to bring this slot down? */ |
428 | rc = sn_slot_disable(bss_hotplug_slot, slot->device_num, | 429 | rc = sn_slot_disable(bss_hotplug_slot, slot->device_num, |
@@ -450,7 +451,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
450 | PCI_REQ_SLOT_DISABLE); | 451 | PCI_REQ_SLOT_DISABLE); |
451 | leaving: | 452 | leaving: |
452 | /* Release the bus lock */ | 453 | /* Release the bus lock */ |
453 | up(&sn_hotplug_sem); | 454 | mutex_unlock(&sn_hotplug_mutex); |
454 | 455 | ||
455 | return rc; | 456 | return rc; |
456 | } | 457 | } |
@@ -462,9 +463,9 @@ static inline int get_power_status(struct hotplug_slot *bss_hotplug_slot, | |||
462 | struct pcibus_info *pcibus_info; | 463 | struct pcibus_info *pcibus_info; |
463 | 464 | ||
464 | pcibus_info = SN_PCIBUS_BUSSOFT_INFO(slot->pci_bus); | 465 | pcibus_info = SN_PCIBUS_BUSSOFT_INFO(slot->pci_bus); |
465 | down(&sn_hotplug_sem); | 466 | mutex_lock(&sn_hotplug_mutex); |
466 | *value = pcibus_info->pbi_enabled_devices & (1 << slot->device_num); | 467 | *value = pcibus_info->pbi_enabled_devices & (1 << slot->device_num); |
467 | up(&sn_hotplug_sem); | 468 | mutex_unlock(&sn_hotplug_mutex); |
468 | return 0; | 469 | return 0; |
469 | } | 470 | } |
470 | 471 | ||
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index b1b4b683cbdd..ac7c2bb6c69e 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/isapnp.h> | 44 | #include <linux/isapnp.h> |
45 | #include <linux/mutex.h> | ||
45 | #include <asm/io.h> | 46 | #include <asm/io.h> |
46 | 47 | ||
47 | #if 0 | 48 | #if 0 |
@@ -92,7 +93,7 @@ MODULE_LICENSE("GPL"); | |||
92 | #define _LTAG_FIXEDMEM32RANGE 0x86 | 93 | #define _LTAG_FIXEDMEM32RANGE 0x86 |
93 | 94 | ||
94 | static unsigned char isapnp_checksum_value; | 95 | static unsigned char isapnp_checksum_value; |
95 | static DECLARE_MUTEX(isapnp_cfg_mutex); | 96 | static DEFINE_MUTEX(isapnp_cfg_mutex); |
96 | static int isapnp_detected; | 97 | static int isapnp_detected; |
97 | static int isapnp_csn_count; | 98 | static int isapnp_csn_count; |
98 | 99 | ||
@@ -903,7 +904,7 @@ int isapnp_cfg_begin(int csn, int logdev) | |||
903 | { | 904 | { |
904 | if (csn < 1 || csn > isapnp_csn_count || logdev > 10) | 905 | if (csn < 1 || csn > isapnp_csn_count || logdev > 10) |
905 | return -EINVAL; | 906 | return -EINVAL; |
906 | down(&isapnp_cfg_mutex); | 907 | mutex_lock(&isapnp_cfg_mutex); |
907 | isapnp_wait(); | 908 | isapnp_wait(); |
908 | isapnp_key(); | 909 | isapnp_key(); |
909 | isapnp_wake(csn); | 910 | isapnp_wake(csn); |
@@ -929,7 +930,7 @@ int isapnp_cfg_begin(int csn, int logdev) | |||
929 | int isapnp_cfg_end(void) | 930 | int isapnp_cfg_end(void) |
930 | { | 931 | { |
931 | isapnp_wait(); | 932 | isapnp_wait(); |
932 | up(&isapnp_cfg_mutex); | 933 | mutex_unlock(&isapnp_cfg_mutex); |
933 | return 0; | 934 | return 0; |
934 | } | 935 | } |
935 | 936 | ||
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index bd06607a5dcc..eecb2afad5c2 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/major.h> | 28 | #include <linux/major.h> |
29 | #include <linux/kdev_t.h> | 29 | #include <linux/kdev_t.h> |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/mutex.h> | ||
31 | 32 | ||
32 | struct class *class3270; | 33 | struct class *class3270; |
33 | 34 | ||
@@ -59,7 +60,7 @@ struct raw3270 { | |||
59 | #define RAW3270_FLAGS_CONSOLE 8 /* Device is the console. */ | 60 | #define RAW3270_FLAGS_CONSOLE 8 /* Device is the console. */ |
60 | 61 | ||
61 | /* Semaphore to protect global data of raw3270 (devices, views, etc). */ | 62 | /* Semaphore to protect global data of raw3270 (devices, views, etc). */ |
62 | static DECLARE_MUTEX(raw3270_sem); | 63 | static DEFINE_MUTEX(raw3270_mutex); |
63 | 64 | ||
64 | /* List of 3270 devices. */ | 65 | /* List of 3270 devices. */ |
65 | static struct list_head raw3270_devices = LIST_HEAD_INIT(raw3270_devices); | 66 | static struct list_head raw3270_devices = LIST_HEAD_INIT(raw3270_devices); |
@@ -815,7 +816,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc) | |||
815 | * number for it. Note: there is no device with minor 0, | 816 | * number for it. Note: there is no device with minor 0, |
816 | * see special case for fs3270.c:fs3270_open(). | 817 | * see special case for fs3270.c:fs3270_open(). |
817 | */ | 818 | */ |
818 | down(&raw3270_sem); | 819 | mutex_lock(&raw3270_mutex); |
819 | /* Keep the list sorted. */ | 820 | /* Keep the list sorted. */ |
820 | minor = RAW3270_FIRSTMINOR; | 821 | minor = RAW3270_FIRSTMINOR; |
821 | rp->minor = -1; | 822 | rp->minor = -1; |
@@ -832,7 +833,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc) | |||
832 | rp->minor = minor; | 833 | rp->minor = minor; |
833 | list_add_tail(&rp->list, &raw3270_devices); | 834 | list_add_tail(&rp->list, &raw3270_devices); |
834 | } | 835 | } |
835 | up(&raw3270_sem); | 836 | mutex_unlock(&raw3270_mutex); |
836 | /* No free minor number? Then give up. */ | 837 | /* No free minor number? Then give up. */ |
837 | if (rp->minor == -1) | 838 | if (rp->minor == -1) |
838 | return -EUSERS; | 839 | return -EUSERS; |
@@ -1003,7 +1004,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) | |||
1003 | 1004 | ||
1004 | if (minor <= 0) | 1005 | if (minor <= 0) |
1005 | return -ENODEV; | 1006 | return -ENODEV; |
1006 | down(&raw3270_sem); | 1007 | mutex_lock(&raw3270_mutex); |
1007 | rc = -ENODEV; | 1008 | rc = -ENODEV; |
1008 | list_for_each_entry(rp, &raw3270_devices, list) { | 1009 | list_for_each_entry(rp, &raw3270_devices, list) { |
1009 | if (rp->minor != minor) | 1010 | if (rp->minor != minor) |
@@ -1024,7 +1025,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) | |||
1024 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); | 1025 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); |
1025 | break; | 1026 | break; |
1026 | } | 1027 | } |
1027 | up(&raw3270_sem); | 1028 | mutex_unlock(&raw3270_mutex); |
1028 | return rc; | 1029 | return rc; |
1029 | } | 1030 | } |
1030 | 1031 | ||
@@ -1038,7 +1039,7 @@ raw3270_find_view(struct raw3270_fn *fn, int minor) | |||
1038 | struct raw3270_view *view, *tmp; | 1039 | struct raw3270_view *view, *tmp; |
1039 | unsigned long flags; | 1040 | unsigned long flags; |
1040 | 1041 | ||
1041 | down(&raw3270_sem); | 1042 | mutex_lock(&raw3270_mutex); |
1042 | view = ERR_PTR(-ENODEV); | 1043 | view = ERR_PTR(-ENODEV); |
1043 | list_for_each_entry(rp, &raw3270_devices, list) { | 1044 | list_for_each_entry(rp, &raw3270_devices, list) { |
1044 | if (rp->minor != minor) | 1045 | if (rp->minor != minor) |
@@ -1057,7 +1058,7 @@ raw3270_find_view(struct raw3270_fn *fn, int minor) | |||
1057 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); | 1058 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); |
1058 | break; | 1059 | break; |
1059 | } | 1060 | } |
1060 | up(&raw3270_sem); | 1061 | mutex_unlock(&raw3270_mutex); |
1061 | return view; | 1062 | return view; |
1062 | } | 1063 | } |
1063 | 1064 | ||
@@ -1104,7 +1105,7 @@ raw3270_delete_device(struct raw3270 *rp) | |||
1104 | struct ccw_device *cdev; | 1105 | struct ccw_device *cdev; |
1105 | 1106 | ||
1106 | /* Remove from device chain. */ | 1107 | /* Remove from device chain. */ |
1107 | down(&raw3270_sem); | 1108 | mutex_lock(&raw3270_mutex); |
1108 | if (rp->clttydev) | 1109 | if (rp->clttydev) |
1109 | class_device_destroy(class3270, | 1110 | class_device_destroy(class3270, |
1110 | MKDEV(IBM_TTY3270_MAJOR, rp->minor)); | 1111 | MKDEV(IBM_TTY3270_MAJOR, rp->minor)); |
@@ -1112,7 +1113,7 @@ raw3270_delete_device(struct raw3270 *rp) | |||
1112 | class_device_destroy(class3270, | 1113 | class_device_destroy(class3270, |
1113 | MKDEV(IBM_FS3270_MAJOR, rp->minor)); | 1114 | MKDEV(IBM_FS3270_MAJOR, rp->minor)); |
1114 | list_del_init(&rp->list); | 1115 | list_del_init(&rp->list); |
1115 | up(&raw3270_sem); | 1116 | mutex_unlock(&raw3270_mutex); |
1116 | 1117 | ||
1117 | /* Disconnect from ccw_device. */ | 1118 | /* Disconnect from ccw_device. */ |
1118 | cdev = rp->cdev; | 1119 | cdev = rp->cdev; |
@@ -1208,13 +1209,13 @@ int raw3270_register_notifier(void (*notifier)(int, int)) | |||
1208 | if (!np) | 1209 | if (!np) |
1209 | return -ENOMEM; | 1210 | return -ENOMEM; |
1210 | np->notifier = notifier; | 1211 | np->notifier = notifier; |
1211 | down(&raw3270_sem); | 1212 | mutex_lock(&raw3270_mutex); |
1212 | list_add_tail(&np->list, &raw3270_notifier); | 1213 | list_add_tail(&np->list, &raw3270_notifier); |
1213 | list_for_each_entry(rp, &raw3270_devices, list) { | 1214 | list_for_each_entry(rp, &raw3270_devices, list) { |
1214 | get_device(&rp->cdev->dev); | 1215 | get_device(&rp->cdev->dev); |
1215 | notifier(rp->minor, 1); | 1216 | notifier(rp->minor, 1); |
1216 | } | 1217 | } |
1217 | up(&raw3270_sem); | 1218 | mutex_unlock(&raw3270_mutex); |
1218 | return 0; | 1219 | return 0; |
1219 | } | 1220 | } |
1220 | 1221 | ||
@@ -1222,14 +1223,14 @@ void raw3270_unregister_notifier(void (*notifier)(int, int)) | |||
1222 | { | 1223 | { |
1223 | struct raw3270_notifier *np; | 1224 | struct raw3270_notifier *np; |
1224 | 1225 | ||
1225 | down(&raw3270_sem); | 1226 | mutex_lock(&raw3270_mutex); |
1226 | list_for_each_entry(np, &raw3270_notifier, list) | 1227 | list_for_each_entry(np, &raw3270_notifier, list) |
1227 | if (np->notifier == notifier) { | 1228 | if (np->notifier == notifier) { |
1228 | list_del(&np->list); | 1229 | list_del(&np->list); |
1229 | kfree(np); | 1230 | kfree(np); |
1230 | break; | 1231 | break; |
1231 | } | 1232 | } |
1232 | up(&raw3270_sem); | 1233 | mutex_unlock(&raw3270_mutex); |
1233 | } | 1234 | } |
1234 | 1235 | ||
1235 | /* | 1236 | /* |
@@ -1256,10 +1257,10 @@ raw3270_set_online (struct ccw_device *cdev) | |||
1256 | goto failure; | 1257 | goto failure; |
1257 | raw3270_create_attributes(rp); | 1258 | raw3270_create_attributes(rp); |
1258 | set_bit(RAW3270_FLAGS_READY, &rp->flags); | 1259 | set_bit(RAW3270_FLAGS_READY, &rp->flags); |
1259 | down(&raw3270_sem); | 1260 | mutex_lock(&raw3270_mutex); |
1260 | list_for_each_entry(np, &raw3270_notifier, list) | 1261 | list_for_each_entry(np, &raw3270_notifier, list) |
1261 | np->notifier(rp->minor, 1); | 1262 | np->notifier(rp->minor, 1); |
1262 | up(&raw3270_sem); | 1263 | mutex_unlock(&raw3270_mutex); |
1263 | return 0; | 1264 | return 0; |
1264 | 1265 | ||
1265 | failure: | 1266 | failure: |
@@ -1307,10 +1308,10 @@ raw3270_remove (struct ccw_device *cdev) | |||
1307 | } | 1308 | } |
1308 | spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); | 1309 | spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); |
1309 | 1310 | ||
1310 | down(&raw3270_sem); | 1311 | mutex_lock(&raw3270_mutex); |
1311 | list_for_each_entry(np, &raw3270_notifier, list) | 1312 | list_for_each_entry(np, &raw3270_notifier, list) |
1312 | np->notifier(rp->minor, 0); | 1313 | np->notifier(rp->minor, 0); |
1313 | up(&raw3270_sem); | 1314 | mutex_unlock(&raw3270_mutex); |
1314 | 1315 | ||
1315 | /* Reset 3270 device. */ | 1316 | /* Reset 3270 device. */ |
1316 | raw3270_reset_device(rp); | 1317 | raw3270_reset_device(rp); |
@@ -1370,13 +1371,13 @@ raw3270_init(void) | |||
1370 | rc = ccw_driver_register(&raw3270_ccw_driver); | 1371 | rc = ccw_driver_register(&raw3270_ccw_driver); |
1371 | if (rc == 0) { | 1372 | if (rc == 0) { |
1372 | /* Create attributes for early (= console) device. */ | 1373 | /* Create attributes for early (= console) device. */ |
1373 | down(&raw3270_sem); | 1374 | mutex_lock(&raw3270_mutex); |
1374 | class3270 = class_create(THIS_MODULE, "3270"); | 1375 | class3270 = class_create(THIS_MODULE, "3270"); |
1375 | list_for_each_entry(rp, &raw3270_devices, list) { | 1376 | list_for_each_entry(rp, &raw3270_devices, list) { |
1376 | get_device(&rp->cdev->dev); | 1377 | get_device(&rp->cdev->dev); |
1377 | raw3270_create_attributes(rp); | 1378 | raw3270_create_attributes(rp); |
1378 | } | 1379 | } |
1379 | up(&raw3270_sem); | 1380 | mutex_unlock(&raw3270_mutex); |
1380 | } | 1381 | } |
1381 | return rc; | 1382 | return rc; |
1382 | } | 1383 | } |
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index 3c987f49f6b4..7a6db1c5c8c5 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/kmod.h> | 29 | #include <linux/kmod.h> |
30 | #include <linux/sem.h> | 30 | #include <linux/sem.h> |
31 | #include <linux/devfs_fs_kernel.h> | 31 | #include <linux/devfs_fs_kernel.h> |
32 | #include <linux/mutex.h> | ||
32 | 33 | ||
33 | #define PHONE_NUM_DEVICES 256 | 34 | #define PHONE_NUM_DEVICES 256 |
34 | 35 | ||
@@ -37,7 +38,7 @@ | |||
37 | */ | 38 | */ |
38 | 39 | ||
39 | static struct phone_device *phone_device[PHONE_NUM_DEVICES]; | 40 | static struct phone_device *phone_device[PHONE_NUM_DEVICES]; |
40 | static DECLARE_MUTEX(phone_lock); | 41 | static DEFINE_MUTEX(phone_lock); |
41 | 42 | ||
42 | /* | 43 | /* |
43 | * Open a phone device. | 44 | * Open a phone device. |
@@ -53,14 +54,14 @@ static int phone_open(struct inode *inode, struct file *file) | |||
53 | if (minor >= PHONE_NUM_DEVICES) | 54 | if (minor >= PHONE_NUM_DEVICES) |
54 | return -ENODEV; | 55 | return -ENODEV; |
55 | 56 | ||
56 | down(&phone_lock); | 57 | mutex_lock(&phone_lock); |
57 | p = phone_device[minor]; | 58 | p = phone_device[minor]; |
58 | if (p) | 59 | if (p) |
59 | new_fops = fops_get(p->f_op); | 60 | new_fops = fops_get(p->f_op); |
60 | if (!new_fops) { | 61 | if (!new_fops) { |
61 | up(&phone_lock); | 62 | mutex_unlock(&phone_lock); |
62 | request_module("char-major-%d-%d", PHONE_MAJOR, minor); | 63 | request_module("char-major-%d-%d", PHONE_MAJOR, minor); |
63 | down(&phone_lock); | 64 | mutex_lock(&phone_lock); |
64 | p = phone_device[minor]; | 65 | p = phone_device[minor]; |
65 | if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL) | 66 | if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL) |
66 | { | 67 | { |
@@ -78,7 +79,7 @@ static int phone_open(struct inode *inode, struct file *file) | |||
78 | } | 79 | } |
79 | fops_put(old_fops); | 80 | fops_put(old_fops); |
80 | end: | 81 | end: |
81 | up(&phone_lock); | 82 | mutex_unlock(&phone_lock); |
82 | return err; | 83 | return err; |
83 | } | 84 | } |
84 | 85 | ||
@@ -100,18 +101,18 @@ int phone_register_device(struct phone_device *p, int unit) | |||
100 | end = unit + 1; /* enter the loop at least one time */ | 101 | end = unit + 1; /* enter the loop at least one time */ |
101 | } | 102 | } |
102 | 103 | ||
103 | down(&phone_lock); | 104 | mutex_lock(&phone_lock); |
104 | for (i = base; i < end; i++) { | 105 | for (i = base; i < end; i++) { |
105 | if (phone_device[i] == NULL) { | 106 | if (phone_device[i] == NULL) { |
106 | phone_device[i] = p; | 107 | phone_device[i] = p; |
107 | p->minor = i; | 108 | p->minor = i; |
108 | devfs_mk_cdev(MKDEV(PHONE_MAJOR,i), | 109 | devfs_mk_cdev(MKDEV(PHONE_MAJOR,i), |
109 | S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i); | 110 | S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i); |
110 | up(&phone_lock); | 111 | mutex_unlock(&phone_lock); |
111 | return 0; | 112 | return 0; |
112 | } | 113 | } |
113 | } | 114 | } |
114 | up(&phone_lock); | 115 | mutex_unlock(&phone_lock); |
115 | return -ENFILE; | 116 | return -ENFILE; |
116 | } | 117 | } |
117 | 118 | ||
@@ -121,12 +122,12 @@ int phone_register_device(struct phone_device *p, int unit) | |||
121 | 122 | ||
122 | void phone_unregister_device(struct phone_device *pfd) | 123 | void phone_unregister_device(struct phone_device *pfd) |
123 | { | 124 | { |
124 | down(&phone_lock); | 125 | mutex_lock(&phone_lock); |
125 | if (phone_device[pfd->minor] != pfd) | 126 | if (phone_device[pfd->minor] != pfd) |
126 | panic("phone: bad unregister"); | 127 | panic("phone: bad unregister"); |
127 | devfs_remove("phone/%d", pfd->minor); | 128 | devfs_remove("phone/%d", pfd->minor); |
128 | phone_device[pfd->minor] = NULL; | 129 | phone_device[pfd->minor] = NULL; |
129 | up(&phone_lock); | 130 | mutex_unlock(&phone_lock); |
130 | } | 131 | } |
131 | 132 | ||
132 | 133 | ||
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 7f0288b25fa1..f28ec6882162 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include <linux/netfilter.h> | 35 | #include <linux/netfilter.h> |
36 | #include <linux/netfilter_ipv4.h> | 36 | #include <linux/netfilter_ipv4.h> |
37 | #include <linux/mutex.h> | ||
37 | 38 | ||
38 | #include <net/ip.h> | 39 | #include <net/ip.h> |
39 | #include <net/route.h> | 40 | #include <net/route.h> |
@@ -44,7 +45,7 @@ | |||
44 | #include <net/ip_vs.h> | 45 | #include <net/ip_vs.h> |
45 | 46 | ||
46 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ | 47 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ |
47 | static DECLARE_MUTEX(__ip_vs_mutex); | 48 | static DEFINE_MUTEX(__ip_vs_mutex); |
48 | 49 | ||
49 | /* lock for service table */ | 50 | /* lock for service table */ |
50 | static DEFINE_RWLOCK(__ip_vs_svc_lock); | 51 | static DEFINE_RWLOCK(__ip_vs_svc_lock); |
@@ -1950,7 +1951,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
1950 | /* increase the module use count */ | 1951 | /* increase the module use count */ |
1951 | ip_vs_use_count_inc(); | 1952 | ip_vs_use_count_inc(); |
1952 | 1953 | ||
1953 | if (down_interruptible(&__ip_vs_mutex)) { | 1954 | if (mutex_lock_interruptible(&__ip_vs_mutex)) { |
1954 | ret = -ERESTARTSYS; | 1955 | ret = -ERESTARTSYS; |
1955 | goto out_dec; | 1956 | goto out_dec; |
1956 | } | 1957 | } |
@@ -2041,7 +2042,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
2041 | ip_vs_service_put(svc); | 2042 | ip_vs_service_put(svc); |
2042 | 2043 | ||
2043 | out_unlock: | 2044 | out_unlock: |
2044 | up(&__ip_vs_mutex); | 2045 | mutex_unlock(&__ip_vs_mutex); |
2045 | out_dec: | 2046 | out_dec: |
2046 | /* decrease the module use count */ | 2047 | /* decrease the module use count */ |
2047 | ip_vs_use_count_dec(); | 2048 | ip_vs_use_count_dec(); |
@@ -2211,7 +2212,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2211 | if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) | 2212 | if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) |
2212 | return -EFAULT; | 2213 | return -EFAULT; |
2213 | 2214 | ||
2214 | if (down_interruptible(&__ip_vs_mutex)) | 2215 | if (mutex_lock_interruptible(&__ip_vs_mutex)) |
2215 | return -ERESTARTSYS; | 2216 | return -ERESTARTSYS; |
2216 | 2217 | ||
2217 | switch (cmd) { | 2218 | switch (cmd) { |
@@ -2330,7 +2331,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2330 | } | 2331 | } |
2331 | 2332 | ||
2332 | out: | 2333 | out: |
2333 | up(&__ip_vs_mutex); | 2334 | mutex_unlock(&__ip_vs_mutex); |
2334 | return ret; | 2335 | return ret; |
2335 | } | 2336 | } |
2336 | 2337 | ||
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c index dc1521c5aa81..ba5e23505e88 100644 --- a/net/ipv4/netfilter/ipt_hashlimit.c +++ b/net/ipv4/netfilter/ipt_hashlimit.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | /* FIXME: this is just for IP_NF_ASSERRT */ | 41 | /* FIXME: this is just for IP_NF_ASSERRT */ |
42 | #include <linux/netfilter_ipv4/ip_conntrack.h> | 42 | #include <linux/netfilter_ipv4/ip_conntrack.h> |
43 | #include <linux/mutex.h> | ||
43 | 44 | ||
44 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
45 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | 46 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); |
@@ -92,7 +93,7 @@ struct ipt_hashlimit_htable { | |||
92 | }; | 93 | }; |
93 | 94 | ||
94 | static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */ | 95 | static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */ |
95 | static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */ | 96 | static DEFINE_MUTEX(hlimit_mutex); /* additional checkentry protection */ |
96 | static HLIST_HEAD(hashlimit_htables); | 97 | static HLIST_HEAD(hashlimit_htables); |
97 | static kmem_cache_t *hashlimit_cachep __read_mostly; | 98 | static kmem_cache_t *hashlimit_cachep __read_mostly; |
98 | 99 | ||
@@ -542,13 +543,13 @@ hashlimit_checkentry(const char *tablename, | |||
542 | * call vmalloc, and that can sleep. And we cannot just re-search | 543 | * call vmalloc, and that can sleep. And we cannot just re-search |
543 | * the list of htable's in htable_create(), since then we would | 544 | * the list of htable's in htable_create(), since then we would |
544 | * create duplicate proc files. -HW */ | 545 | * create duplicate proc files. -HW */ |
545 | down(&hlimit_mutex); | 546 | mutex_lock(&hlimit_mutex); |
546 | r->hinfo = htable_find_get(r->name); | 547 | r->hinfo = htable_find_get(r->name); |
547 | if (!r->hinfo && (htable_create(r) != 0)) { | 548 | if (!r->hinfo && (htable_create(r) != 0)) { |
548 | up(&hlimit_mutex); | 549 | mutex_unlock(&hlimit_mutex); |
549 | return 0; | 550 | return 0; |
550 | } | 551 | } |
551 | up(&hlimit_mutex); | 552 | mutex_unlock(&hlimit_mutex); |
552 | 553 | ||
553 | /* Ugly hack: For SMP, we only want to use one set */ | 554 | /* Ugly hack: For SMP, we only want to use one set */ |
554 | r->u.master = r; | 555 | r->u.master = r; |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 43e72419c868..f329b72578f5 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -13,26 +13,27 @@ | |||
13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/skbuff.h> | 15 | #include <linux/skbuff.h> |
16 | #include <linux/mutex.h> | ||
16 | #include <net/sock.h> | 17 | #include <net/sock.h> |
17 | #include <net/genetlink.h> | 18 | #include <net/genetlink.h> |
18 | 19 | ||
19 | struct sock *genl_sock = NULL; | 20 | struct sock *genl_sock = NULL; |
20 | 21 | ||
21 | static DECLARE_MUTEX(genl_sem); /* serialization of message processing */ | 22 | static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ |
22 | 23 | ||
23 | static void genl_lock(void) | 24 | static void genl_lock(void) |
24 | { | 25 | { |
25 | down(&genl_sem); | 26 | mutex_lock(&genl_mutex); |
26 | } | 27 | } |
27 | 28 | ||
28 | static int genl_trylock(void) | 29 | static int genl_trylock(void) |
29 | { | 30 | { |
30 | return down_trylock(&genl_sem); | 31 | return !mutex_trylock(&genl_mutex); |
31 | } | 32 | } |
32 | 33 | ||
33 | static void genl_unlock(void) | 34 | static void genl_unlock(void) |
34 | { | 35 | { |
35 | up(&genl_sem); | 36 | mutex_unlock(&genl_mutex); |
36 | 37 | ||
37 | if (genl_sock && genl_sock->sk_receive_queue.qlen) | 38 | if (genl_sock && genl_sock->sk_receive_queue.qlen) |
38 | genl_sock->sk_data_ready(genl_sock, 0); | 39 | genl_sock->sk_data_ready(genl_sock, 0); |