Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Ingo Molnar and committed by
Linus Torvalds
14cc3e2b 353ab6e9

+172 -157
+6 -6
arch/arm26/kernel/traps.c
··· 34 34 #include <asm/system.h> 35 35 #include <asm/uaccess.h> 36 36 #include <asm/unistd.h> 37 - #include <asm/semaphore.h> 37 + #include <linux/mutex.h> 38 38 39 39 #include "ptrace.h" 40 40 ··· 207 207 die(str, regs, err); 208 208 } 209 209 210 - static DECLARE_MUTEX(undef_sem); 210 + static DEFINE_MUTEX(undef_mutex); 211 211 static int (*undef_hook)(struct pt_regs *); 212 212 213 213 int request_undef_hook(int (*fn)(struct pt_regs *)) 214 214 { 215 215 int ret = -EBUSY; 216 216 217 - down(&undef_sem); 217 + mutex_lock(&undef_mutex); 218 218 if (undef_hook == NULL) { 219 219 undef_hook = fn; 220 220 ret = 0; 221 221 } 222 - up(&undef_sem); 222 + mutex_unlock(&undef_mutex); 223 223 224 224 return ret; 225 225 } ··· 228 228 { 229 229 int ret = -EINVAL; 230 230 231 - down(&undef_sem); 231 + mutex_lock(&undef_mutex); 232 232 if (undef_hook == fn) { 233 233 undef_hook = NULL; 234 234 ret = 0; 235 235 } 236 - up(&undef_sem); 236 + mutex_unlock(&undef_mutex); 237 237 238 238 return ret; 239 239 }
+5 -4
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
··· 40 40 41 41 #ifdef CONFIG_X86_POWERNOW_K8_ACPI 42 42 #include <linux/acpi.h> 43 + #include <linux/mutex.h> 43 44 #include <acpi/processor.h> 44 45 #endif 45 46 ··· 50 49 #include "powernow-k8.h" 51 50 52 51 /* serialize freq changes */ 53 - static DECLARE_MUTEX(fidvid_sem); 52 + static DEFINE_MUTEX(fidvid_mutex); 54 53 55 54 static struct powernow_k8_data *powernow_data[NR_CPUS]; 56 55 ··· 944 943 if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) 945 944 goto err_out; 946 945 947 - down(&fidvid_sem); 946 + mutex_lock(&fidvid_mutex); 948 947 949 948 powernow_k8_acpi_pst_values(data, newstate); 950 949 951 950 if (transition_frequency(data, newstate)) { 952 951 printk(KERN_ERR PFX "transition frequency failed\n"); 953 952 ret = 1; 954 - up(&fidvid_sem); 953 + mutex_unlock(&fidvid_mutex); 955 954 goto err_out; 956 955 } 957 - up(&fidvid_sem); 956 + mutex_unlock(&fidvid_mutex); 958 957 959 958 pol->cur = find_khz_freq_from_fid(data->currfid); 960 959 ret = 0;
+7 -6
arch/i386/kernel/cpu/mtrr/main.c
··· 36 36 #include <linux/pci.h> 37 37 #include <linux/smp.h> 38 38 #include <linux/cpu.h> 39 + #include <linux/mutex.h> 39 40 40 41 #include <asm/mtrr.h> 41 42 ··· 48 47 u32 num_var_ranges = 0; 49 48 50 49 unsigned int *usage_table; 51 - static DECLARE_MUTEX(mtrr_sem); 50 + static DEFINE_MUTEX(mtrr_mutex); 52 51 53 52 u32 size_or_mask, size_and_mask; 54 53 ··· 334 333 /* No CPU hotplug when we change MTRR entries */ 335 334 lock_cpu_hotplug(); 336 335 /* Search for existing MTRR */ 337 - down(&mtrr_sem); 336 + mutex_lock(&mtrr_mutex); 338 337 for (i = 0; i < num_var_ranges; ++i) { 339 338 mtrr_if->get(i, &lbase, &lsize, &ltype); 340 339 if (base >= lbase + lsize) ··· 372 371 printk(KERN_INFO "mtrr: no more MTRRs available\n"); 373 372 error = i; 374 373 out: 375 - up(&mtrr_sem); 374 + mutex_unlock(&mtrr_mutex); 376 375 unlock_cpu_hotplug(); 377 376 return error; 378 377 } ··· 465 464 max = num_var_ranges; 466 465 /* No CPU hotplug when we change MTRR entries */ 467 466 lock_cpu_hotplug(); 468 - down(&mtrr_sem); 467 + mutex_lock(&mtrr_mutex); 469 468 if (reg < 0) { 470 469 /* Search for existing MTRR */ 471 470 for (i = 0; i < max; ++i) { ··· 504 503 set_mtrr(reg, 0, 0, 0); 505 504 error = reg; 506 505 out: 507 - up(&mtrr_sem); 506 + mutex_unlock(&mtrr_mutex); 508 507 unlock_cpu_hotplug(); 509 508 return error; 510 509 } ··· 686 685 if (!mtrr_if || !use_intel()) 687 686 return; 688 687 /* 689 - * Ideally we should hold mtrr_sem here to avoid mtrr entries changed, 688 + * Ideally we should hold mtrr_mutex here to avoid mtrr entries changed, 690 689 * but this routine will be called in cpu boot time, holding the lock 691 690 * breaks it. This routine is called in two cases: 1.very earily time 692 691 * of software resume, when there absolutely isn't mtrr entry changes;
+4 -3
arch/i386/kernel/microcode.c
··· 81 81 #include <linux/miscdevice.h> 82 82 #include <linux/spinlock.h> 83 83 #include <linux/mm.h> 84 + #include <linux/mutex.h> 84 85 85 86 #include <asm/msr.h> 86 87 #include <asm/uaccess.h> ··· 115 114 static DEFINE_SPINLOCK(microcode_update_lock); 116 115 117 116 /* no concurrent ->write()s are allowed on /dev/cpu/microcode */ 118 - static DECLARE_MUTEX(microcode_sem); 117 + static DEFINE_MUTEX(microcode_mutex); 119 118 120 119 static void __user *user_buffer; /* user area microcode data buffer */ 121 120 static unsigned int user_buffer_size; /* it's size */ ··· 445 444 return -EINVAL; 446 445 } 447 446 448 - down(&microcode_sem); 447 + mutex_lock(&microcode_mutex); 449 448 450 449 user_buffer = (void __user *) buf; 451 450 user_buffer_size = (int) len; ··· 454 453 if (!ret) 455 454 ret = (ssize_t)len; 456 455 457 - up(&microcode_sem); 456 + mutex_unlock(&microcode_mutex); 458 457 459 458 return ret; 460 459 }
+32 -31
arch/mips/lasat/sysctl.c
··· 30 30 #include <linux/string.h> 31 31 #include <linux/net.h> 32 32 #include <linux/inet.h> 33 + #include <linux/mutex.h> 33 34 #include <asm/uaccess.h> 34 35 35 36 #include "sysctl.h" 36 37 #include "ds1603.h" 37 38 38 - static DECLARE_MUTEX(lasat_info_sem); 39 + static DEFINE_MUTEX(lasat_info_mutex); 39 40 40 41 /* Strategy function to write EEPROM after changing string entry */ 41 42 int sysctl_lasatstring(ctl_table *table, int *name, int nlen, ··· 44 43 void *newval, size_t newlen, void **context) 45 44 { 46 45 int r; 47 - down(&lasat_info_sem); 46 + mutex_lock(&lasat_info_mutex); 48 47 r = sysctl_string(table, name, 49 48 nlen, oldval, oldlenp, newval, newlen, context); 50 49 if (r < 0) { 51 - up(&lasat_info_sem); 50 + mutex_unlock(&lasat_info_mutex); 52 51 return r; 53 52 } 54 53 if (newval && newlen) { 55 54 lasat_write_eeprom_info(); 56 55 } 57 - up(&lasat_info_sem); 56 + mutex_unlock(&lasat_info_mutex); 58 57 return 1; 59 58 } 60 59 ··· 64 63 void *buffer, size_t *lenp, loff_t *ppos) 65 64 { 66 65 int r; 67 - down(&lasat_info_sem); 66 + mutex_lock(&lasat_info_mutex); 68 67 r = proc_dostring(table, write, filp, buffer, lenp, ppos); 69 68 if ( (!write) || r) { 70 - up(&lasat_info_sem); 69 + mutex_unlock(&lasat_info_mutex); 71 70 return r; 72 71 } 73 72 lasat_write_eeprom_info(); 74 - up(&lasat_info_sem); 73 + mutex_unlock(&lasat_info_mutex); 75 74 return 0; 76 75 } 77 76 ··· 80 79 void *buffer, size_t *lenp, loff_t *ppos) 81 80 { 82 81 int r; 83 - down(&lasat_info_sem); 82 + mutex_lock(&lasat_info_mutex); 84 83 r = proc_dointvec(table, write, filp, buffer, lenp, ppos); 85 84 if ( (!write) || r) { 86 - up(&lasat_info_sem); 85 + mutex_unlock(&lasat_info_mutex); 87 86 return r; 88 87 } 89 88 lasat_write_eeprom_info(); 90 - up(&lasat_info_sem); 89 + mutex_unlock(&lasat_info_mutex); 91 90 return 0; 92 91 } 93 92 ··· 99 98 void *buffer, size_t *lenp, loff_t *ppos) 100 99 { 101 100 int r; 102 - down(&lasat_info_sem); 101 + mutex_lock(&lasat_info_mutex); 103 102 if (!write) { 104 103 rtctmp = ds1603_read(); 105 104 /* check for time < 0 and set to 0 */ ··· 108 107 } 109 108 r = proc_dointvec(table, write, filp, buffer, lenp, ppos); 110 109 if ( (!write) || r) { 111 - up(&lasat_info_sem); 110 + mutex_unlock(&lasat_info_mutex); 112 111 return r; 113 112 } 114 113 ds1603_set(rtctmp); 115 - up(&lasat_info_sem); 114 + mutex_unlock(&lasat_info_mutex); 116 115 return 0; 117 116 } 118 117 #endif ··· 123 122 void *newval, size_t newlen, void **context) 124 123 { 125 124 int r; 126 - down(&lasat_info_sem); 125 + mutex_lock(&lasat_info_mutex); 127 126 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); 128 127 if (r < 0) { 129 - up(&lasat_info_sem); 128 + mutex_unlock(&lasat_info_mutex); 130 129 return r; 131 130 } 132 131 if (newval && newlen) { 133 132 lasat_write_eeprom_info(); 134 133 } 135 - up(&lasat_info_sem); 134 + mutex_unlock(&lasat_info_mutex); 136 135 return 1; 137 136 } 138 137 ··· 143 142 void *newval, size_t newlen, void **context) 144 143 { 145 144 int r; 146 - down(&lasat_info_sem); 145 + mutex_lock(&lasat_info_mutex); 147 146 rtctmp = ds1603_read(); 148 147 if (rtctmp < 0) 149 148 rtctmp = 0; 150 149 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); 151 150 if (r < 0) { 152 - up(&lasat_info_sem); 151 + mutex_unlock(&lasat_info_mutex); 153 152 return r; 154 153 } 155 154 if (newval && newlen) { 156 155 ds1603_set(rtctmp); 157 156 } 158 - up(&lasat_info_sem); 157 + mutex_unlock(&lasat_info_mutex); 159 158 return 1; 160 159 } 161 160 #endif ··· 193 192 return 0; 194 193 } 195 194 196 - down(&lasat_info_sem); 195 + mutex_lock(&lasat_info_mutex); 197 196 if (write) { 198 197 len = 0; 199 198 p = buffer; 200 199 while (len < *lenp) { 201 200 if(get_user(c, p++)) { 202 - up(&lasat_info_sem); 201 + mutex_unlock(&lasat_info_mutex); 203 202 return -EFAULT; 204 203 } 205 204 if (c == 0 || c == '\n') ··· 210 209 len = sizeof(proc_lasat_ipbuf) - 1; 211 210 if (copy_from_user(proc_lasat_ipbuf, buffer, len)) 212 211 { 213 - up(&lasat_info_sem); 212 + mutex_unlock(&lasat_info_mutex); 214 213 return -EFAULT; 215 214 } 216 215 proc_lasat_ipbuf[len] = 0; ··· 231 230 len = *lenp; 232 231 if (len) 233 232 if(copy_to_user(buffer, proc_lasat_ipbuf, len)) { 234 - up(&lasat_info_sem); 233 + mutex_unlock(&lasat_info_mutex); 235 234 return -EFAULT; 236 235 } 237 236 if (len < *lenp) { 238 237 if(put_user('\n', ((char *) buffer) + len)) { 239 - up(&lasat_info_sem); 238 + mutex_unlock(&lasat_info_mutex); 240 239 return -EFAULT; 241 240 } 242 241 len++; ··· 245 244 *ppos += len; 246 245 } 247 246 update_bcastaddr(); 248 - up(&lasat_info_sem); 247 + mutex_unlock(&lasat_info_mutex); 249 248 return 0; 250 249 } 251 250 #endif /* defined(CONFIG_INET) */ ··· 257 256 { 258 257 int r; 259 258 260 - down(&lasat_info_sem); 259 + mutex_lock(&lasat_info_mutex); 261 260 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen, context); 262 261 if (r < 0) { 263 - up(&lasat_info_sem); 262 + mutex_unlock(&lasat_info_mutex); 264 263 return r; 265 264 } 266 265 ··· 272 271 lasat_write_eeprom_info(); 273 272 lasat_init_board_info(); 274 273 } 275 - up(&lasat_info_sem); 274 + mutex_unlock(&lasat_info_mutex); 276 275 277 276 return 0; 278 277 } ··· 281 280 void *buffer, size_t *lenp, loff_t *ppos) 282 281 { 283 282 int r; 284 - down(&lasat_info_sem); 283 + mutex_lock(&lasat_info_mutex); 285 284 r = proc_dointvec(table, write, filp, buffer, lenp, ppos); 286 285 if ( (!write) || r) { 287 - up(&lasat_info_sem); 286 + mutex_unlock(&lasat_info_mutex); 288 287 return r; 289 288 } 290 289 if (filp && filp->f_dentry) ··· 295 294 lasat_board_info.li_eeprom_info.debugaccess = lasat_board_info.li_debugaccess; 296 295 } 297 296 lasat_write_eeprom_info(); 298 - up(&lasat_info_sem); 297 + mutex_unlock(&lasat_info_mutex); 299 298 return 0; 300 299 } 301 300
+9 -9
arch/powerpc/mm/imalloc.c
··· 13 13 #include <asm/uaccess.h> 14 14 #include <asm/pgalloc.h> 15 15 #include <asm/pgtable.h> 16 - #include <asm/semaphore.h> 16 + #include <linux/mutex.h> 17 17 #include <asm/cacheflush.h> 18 18 19 19 #include "mmu_decl.h" 20 20 21 - static DECLARE_MUTEX(imlist_sem); 21 + static DEFINE_MUTEX(imlist_mutex); 22 22 struct vm_struct * imlist = NULL; 23 23 24 24 static int get_free_im_addr(unsigned long size, unsigned long *im_addr) ··· 257 257 struct vm_struct *area; 258 258 unsigned long addr; 259 259 260 - down(&imlist_sem); 260 + mutex_lock(&imlist_mutex); 261 261 if (get_free_im_addr(size, &addr)) { 262 262 printk(KERN_ERR "%s() cannot obtain addr for size 0x%lx\n", 263 263 __FUNCTION__, size); ··· 272 272 __FUNCTION__, addr, size); 273 273 } 274 274 next_im_done: 275 - up(&imlist_sem); 275 + mutex_unlock(&imlist_mutex); 276 276 return area; 277 277 } 278 278 ··· 281 281 { 282 282 struct vm_struct *area; 283 283 284 - down(&imlist_sem); 284 + mutex_lock(&imlist_mutex); 285 285 area = __im_get_area(v_addr, size, criteria); 286 - up(&imlist_sem); 286 + mutex_unlock(&imlist_mutex); 287 287 return area; 288 288 } 289 289 ··· 297 297 printk(KERN_ERR "Trying to %s bad address (%p)\n", __FUNCTION__, addr); 298 298 return; 299 299 } 300 - down(&imlist_sem); 300 + mutex_lock(&imlist_mutex); 301 301 for (p = &imlist ; (tmp = *p) ; p = &tmp->next) { 302 302 if (tmp->addr == addr) { 303 303 *p = tmp->next; 304 304 unmap_vm_area(tmp); 305 305 kfree(tmp); 306 - up(&imlist_sem); 306 + mutex_unlock(&imlist_mutex); 307 307 return; 308 308 } 309 309 } 310 - up(&imlist_sem); 310 + mutex_unlock(&imlist_mutex); 311 311 printk(KERN_ERR "Trying to %s nonexistent area (%p)\n", __FUNCTION__, 312 312 addr); 313 313 }
+11 -11
arch/powerpc/platforms/cell/spu_base.c
··· 32 32 33 33 #include <asm/io.h> 34 34 #include <asm/prom.h> 35 - #include <asm/semaphore.h> 35 + #include <linux/mutex.h> 36 36 #include <asm/spu.h> 37 37 #include <asm/mmu_context.h> 38 38 ··· 342 342 } 343 343 344 344 static LIST_HEAD(spu_list); 345 - static DECLARE_MUTEX(spu_mutex); 345 + static DEFINE_MUTEX(spu_mutex); 346 346 347 347 static void spu_init_channels(struct spu *spu) 348 348 { ··· 382 382 { 383 383 struct spu *spu; 384 384 385 - down(&spu_mutex); 385 + mutex_lock(&spu_mutex); 386 386 if (!list_empty(&spu_list)) { 387 387 spu = list_entry(spu_list.next, struct spu, list); 388 388 list_del_init(&spu->list); ··· 391 391 pr_debug("No SPU left\n"); 392 392 spu = NULL; 393 393 } 394 - up(&spu_mutex); 394 + mutex_unlock(&spu_mutex); 395 395 396 396 if (spu) 397 397 spu_init_channels(spu); ··· 402 402 403 403 void spu_free(struct spu *spu) 404 404 { 405 - down(&spu_mutex); 405 + mutex_lock(&spu_mutex); 406 406 list_add_tail(&spu->list, &spu_list); 407 - up(&spu_mutex); 407 + mutex_unlock(&spu_mutex); 408 408 } 409 409 EXPORT_SYMBOL_GPL(spu_free); 410 410 ··· 633 633 spu->wbox_callback = NULL; 634 634 spu->stop_callback = NULL; 635 635 636 - down(&spu_mutex); 636 + mutex_lock(&spu_mutex); 637 637 spu->number = number++; 638 638 ret = spu_request_irqs(spu); 639 639 if (ret) 640 640 goto out_unmap; 641 641 642 642 list_add(&spu->list, &spu_list); 643 - up(&spu_mutex); 643 + mutex_unlock(&spu_mutex); 644 644 645 645 pr_debug(KERN_DEBUG "Using SPE %s %02x %p %p %p %p %d\n", 646 646 spu->name, spu->isrc, spu->local_store, ··· 648 648 goto out; 649 649 650 650 out_unmap: 651 - up(&spu_mutex); 651 + mutex_unlock(&spu_mutex); 652 652 spu_unmap(spu); 653 653 out_free: 654 654 kfree(spu); ··· 668 668 static void cleanup_spu_base(void) 669 669 { 670 670 struct spu *spu, *tmp; 671 - down(&spu_mutex); 671 + mutex_lock(&spu_mutex); 672 672 list_for_each_entry_safe(spu, tmp, &spu_list, list) 673 673 destroy_spu(spu); 674 - up(&spu_mutex); 674 + mutex_unlock(&spu_mutex); 675 675 } 676 676 module_exit(cleanup_spu_base); 677 677
+4 -3
arch/powerpc/platforms/powermac/cpufreq_64.c
··· 21 21 #include <linux/cpufreq.h> 22 22 #include <linux/init.h> 23 23 #include <linux/completion.h> 24 + #include <linux/mutex.h> 24 25 #include <asm/prom.h> 25 26 #include <asm/machdep.h> 26 27 #include <asm/irq.h> ··· 91 90 static int (*g5_switch_freq)(int speed_mode); 92 91 static int (*g5_query_freq)(void); 93 92 94 - static DECLARE_MUTEX(g5_switch_mutex); 93 + static DEFINE_MUTEX(g5_switch_mutex); 95 94 96 95 97 96 static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ ··· 328 327 if (g5_pmode_cur == newstate) 329 328 return 0; 330 329 331 - down(&g5_switch_mutex); 330 + mutex_lock(&g5_switch_mutex); 332 331 333 332 freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; 334 333 freqs.new = g5_cpu_freqs[newstate].frequency; ··· 338 337 rc = g5_switch_freq(newstate); 339 338 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 340 339 341 - up(&g5_switch_mutex); 340 + mutex_unlock(&g5_switch_mutex); 342 341 343 342 return rc; 344 343 }
+5 -4
drivers/macintosh/smu.c
··· 35 35 #include <linux/delay.h> 36 36 #include <linux/sysdev.h> 37 37 #include <linux/poll.h> 38 + #include <linux/mutex.h> 38 39 39 40 #include <asm/byteorder.h> 40 41 #include <asm/io.h> ··· 93 92 * for now, just hard code that 94 93 */ 95 94 static struct smu_device *smu; 96 - static DECLARE_MUTEX(smu_part_access); 95 + static DEFINE_MUTEX(smu_part_access); 97 96 98 97 static void smu_i2c_retry(unsigned long data); 99 98 ··· 977 976 978 977 if (interruptible) { 979 978 int rc; 980 - rc = down_interruptible(&smu_part_access); 979 + rc = mutex_lock_interruptible(&smu_part_access); 981 980 if (rc) 982 981 return ERR_PTR(rc); 983 982 } else 984 - down(&smu_part_access); 983 + mutex_lock(&smu_part_access); 985 984 986 985 part = (struct smu_sdbp_header *)get_property(smu->of_node, 987 986 pname, size); ··· 991 990 if (part != NULL && size) 992 991 *size = part->len << 2; 993 992 } 994 - up(&smu_part_access); 993 + mutex_unlock(&smu_part_access); 995 994 return part; 996 995 } 997 996
+8 -8
drivers/md/kcopyd.c
··· 590 590 up(&_client_lock); 591 591 } 592 592 593 - static DECLARE_MUTEX(kcopyd_init_lock); 593 + static DEFINE_MUTEX(kcopyd_init_lock); 594 594 static int kcopyd_clients = 0; 595 595 596 596 static int kcopyd_init(void) 597 597 { 598 598 int r; 599 599 600 - down(&kcopyd_init_lock); 600 + mutex_lock(&kcopyd_init_lock); 601 601 602 602 if (kcopyd_clients) { 603 603 /* Already initialized. */ 604 604 kcopyd_clients++; 605 - up(&kcopyd_init_lock); 605 + mutex_unlock(&kcopyd_init_lock); 606 606 return 0; 607 607 } 608 608 609 609 r = jobs_init(); 610 610 if (r) { 611 - up(&kcopyd_init_lock); 611 + mutex_unlock(&kcopyd_init_lock); 612 612 return r; 613 613 } 614 614 615 615 _kcopyd_wq = create_singlethread_workqueue("kcopyd"); 616 616 if (!_kcopyd_wq) { 617 617 jobs_exit(); 618 - up(&kcopyd_init_lock); 618 + mutex_unlock(&kcopyd_init_lock); 619 619 return -ENOMEM; 620 620 } 621 621 622 622 kcopyd_clients++; 623 623 INIT_WORK(&_kcopyd_work, do_work, NULL); 624 - up(&kcopyd_init_lock); 624 + mutex_unlock(&kcopyd_init_lock); 625 625 return 0; 626 626 } 627 627 628 628 static void kcopyd_exit(void) 629 629 { 630 - down(&kcopyd_init_lock); 630 + mutex_lock(&kcopyd_init_lock); 631 631 kcopyd_clients--; 632 632 if (!kcopyd_clients) { 633 633 jobs_exit(); 634 634 destroy_workqueue(_kcopyd_wq); 635 635 _kcopyd_wq = NULL; 636 636 } 637 - up(&kcopyd_init_lock); 637 + mutex_unlock(&kcopyd_init_lock); 638 638 } 639 639 640 640 int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result)
+4 -3
drivers/net/wan/dscc4.c
··· 105 105 #include <linux/delay.h> 106 106 #include <net/syncppp.h> 107 107 #include <linux/hdlc.h> 108 + #include <linux/mutex.h> 108 109 109 110 /* Version */ 110 111 static const char version[] = "$Id: dscc4.c,v 1.173 2003/09/20 23:55:34 romieu Exp $ for Linux\n"; ··· 113 112 static int quartz; 114 113 115 114 #ifdef CONFIG_DSCC4_PCI_RST 116 - static DECLARE_MUTEX(dscc4_sem); 115 + static DEFINE_MUTEX(dscc4_mutex); 117 116 static u32 dscc4_pci_config_store[16]; 118 117 #endif 119 118 ··· 1019 1018 { 1020 1019 int i; 1021 1020 1022 - down(&dscc4_sem); 1021 + mutex_lock(&dscc4_mutex); 1023 1022 for (i = 0; i < 16; i++) 1024 1023 pci_read_config_dword(pdev, i << 2, dscc4_pci_config_store + i); 1025 1024 ··· 1040 1039 1041 1040 for (i = 0; i < 16; i++) 1042 1041 pci_write_config_dword(pdev, i << 2, dscc4_pci_config_store[i]); 1043 - up(&dscc4_sem); 1042 + mutex_unlock(&dscc4_mutex); 1044 1043 } 1045 1044 #else 1046 1045 #define dscc4_pci_reset(pdev,ioaddr) do {} while (0)
+10 -9
drivers/parport/share.c
··· 32 32 #include <linux/kmod.h> 33 33 34 34 #include <linux/spinlock.h> 35 + #include <linux/mutex.h> 35 36 #include <asm/irq.h> 36 37 37 38 #undef PARPORT_PARANOID ··· 51 50 52 51 static LIST_HEAD(drivers); 53 52 54 - static DECLARE_MUTEX(registration_lock); 53 + static DEFINE_MUTEX(registration_lock); 55 54 56 55 /* What you can do to a port that's gone away.. */ 57 56 static void dead_write_lines (struct parport *p, unsigned char b){} ··· 159 158 if (list_empty(&portlist)) 160 159 get_lowlevel_driver (); 161 160 162 - down(&registration_lock); 161 + mutex_lock(&registration_lock); 163 162 list_for_each_entry(port, &portlist, list) 164 163 drv->attach(port); 165 164 list_add(&drv->list, &drivers); 166 - up(&registration_lock); 165 + mutex_unlock(&registration_lock); 167 166 168 167 return 0; 169 168 } ··· 189 188 { 190 189 struct parport *port; 191 190 192 - down(&registration_lock); 191 + mutex_lock(&registration_lock); 193 192 list_del_init(&drv->list); 194 193 list_for_each_entry(port, &portlist, list) 195 194 drv->detach(port); 196 - up(&registration_lock); 195 + mutex_unlock(&registration_lock); 197 196 } 198 197 199 198 static void free_port (struct parport *port) ··· 367 366 #endif 368 367 369 368 parport_proc_register(port); 370 - down(&registration_lock); 369 + mutex_lock(&registration_lock); 371 370 spin_lock_irq(&parportlist_lock); 372 371 list_add_tail(&port->list, &portlist); 373 372 for (i = 1; i < 3; i++) { ··· 384 383 if (slave) 385 384 attach_driver_chain(slave); 386 385 } 387 - up(&registration_lock); 386 + mutex_unlock(&registration_lock); 388 387 } 389 388 390 389 /** ··· 410 409 { 411 410 int i; 412 411 413 - down(&registration_lock); 412 + mutex_lock(&registration_lock); 414 413 415 414 /* Spread the word. */ 416 415 detach_driver_chain (port); ··· 437 436 } 438 437 spin_unlock(&parportlist_lock); 439 438 440 - up(&registration_lock); 439 + mutex_unlock(&registration_lock); 441 440 442 441 parport_proc_unregister(port); 443 442
+6 -6
drivers/pci/hotplug/rpadlpar_core.c
··· 19 19 #include <linux/string.h> 20 20 21 21 #include <asm/pci-bridge.h> 22 - #include <asm/semaphore.h> 22 + #include <linux/mutex.h> 23 23 #include <asm/rtas.h> 24 24 #include <asm/vio.h> 25 25 ··· 27 27 #include "rpaphp.h" 28 28 #include "rpadlpar.h" 29 29 30 - static DECLARE_MUTEX(rpadlpar_sem); 30 + static DEFINE_MUTEX(rpadlpar_mutex); 31 31 32 32 #define DLPAR_MODULE_NAME "rpadlpar_io" 33 33 ··· 300 300 int node_type; 301 301 int rc = -EIO; 302 302 303 - if (down_interruptible(&rpadlpar_sem)) 303 + if (mutex_lock_interruptible(&rpadlpar_mutex)) 304 304 return -ERESTARTSYS; 305 305 306 306 /* Find newly added node */ ··· 324 324 325 325 printk(KERN_INFO "%s: slot %s added\n", DLPAR_MODULE_NAME, drc_name); 326 326 exit: 327 - up(&rpadlpar_sem); 327 + mutex_unlock(&rpadlpar_mutex); 328 328 return rc; 329 329 } 330 330 ··· 417 417 int node_type; 418 418 int rc = 0; 419 419 420 - if (down_interruptible(&rpadlpar_sem)) 420 + if (mutex_lock_interruptible(&rpadlpar_mutex)) 421 421 return -ERESTARTSYS; 422 422 423 423 dn = find_dlpar_node(drc_name, &node_type); ··· 439 439 } 440 440 printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name); 441 441 exit: 442 - up(&rpadlpar_sem); 442 + mutex_unlock(&rpadlpar_mutex); 443 443 return rc; 444 444 } 445 445
+10 -9
drivers/pci/hotplug/sgi_hotplug.c
··· 15 15 #include <linux/pci.h> 16 16 #include <linux/proc_fs.h> 17 17 #include <linux/types.h> 18 + #include <linux/mutex.h> 18 19 19 20 #include <asm/sn/addrs.h> 20 21 #include <asm/sn/l1.h> ··· 82 81 .get_power_status = get_power_status, 83 82 }; 84 83 85 - static DECLARE_MUTEX(sn_hotplug_sem); 84 + static DEFINE_MUTEX(sn_hotplug_mutex); 86 85 87 86 static ssize_t path_show (struct hotplug_slot *bss_hotplug_slot, 88 87 char *buf) ··· 347 346 int rc; 348 347 349 348 /* Serialize the Linux PCI infrastructure */ 350 - down(&sn_hotplug_sem); 349 + mutex_lock(&sn_hotplug_mutex); 351 350 352 351 /* 353 352 * Power-on and initialize the slot in the SN ··· 355 354 */ 356 355 rc = sn_slot_enable(bss_hotplug_slot, slot->device_num); 357 356 if (rc) { 358 - up(&sn_hotplug_sem); 357 + mutex_unlock(&sn_hotplug_mutex); 359 358 return rc; 360 359 } 361 360 ··· 363 362 PCI_DEVFN(slot->device_num + 1, 0)); 364 363 if (!num_funcs) { 365 364 dev_dbg(slot->pci_bus->self, "no device in slot\n"); 366 - up(&sn_hotplug_sem); 365 + mutex_unlock(&sn_hotplug_mutex); 367 366 return -ENODEV; 368 367 } 369 368 ··· 403 402 if (new_ppb) 404 403 pci_bus_add_devices(new_bus); 405 404 406 - up(&sn_hotplug_sem); 405 + mutex_unlock(&sn_hotplug_mutex); 407 406 408 407 if (rc == 0) 409 408 dev_dbg(slot->pci_bus->self, ··· 423 422 int rc; 424 423 425 424 /* Acquire update access to the bus */ 426 - down(&sn_hotplug_sem); 425 + mutex_lock(&sn_hotplug_mutex); 427 426 428 427 /* is it okay to bring this slot down? */ 429 428 rc = sn_slot_disable(bss_hotplug_slot, slot->device_num, ··· 451 450 PCI_REQ_SLOT_DISABLE); 452 451 leaving: 453 452 /* Release the bus lock */ 454 - up(&sn_hotplug_sem); 453 + mutex_unlock(&sn_hotplug_mutex); 455 454 456 455 return rc; 457 456 } ··· 463 462 struct pcibus_info *pcibus_info; 464 463 465 464 pcibus_info = SN_PCIBUS_BUSSOFT_INFO(slot->pci_bus); 466 - down(&sn_hotplug_sem); 465 + mutex_lock(&sn_hotplug_mutex); 467 466 *value = pcibus_info->pbi_enabled_devices & (1 << slot->device_num); 468 - up(&sn_hotplug_sem); 467 + mutex_unlock(&sn_hotplug_mutex); 469 468 return 0; 470 469 } 471 470
+4 -3
drivers/pnp/isapnp/core.c
··· 42 42 #include <linux/delay.h> 43 43 #include <linux/init.h> 44 44 #include <linux/isapnp.h> 45 + #include <linux/mutex.h> 45 46 #include <asm/io.h> 46 47 47 48 #if 0 ··· 93 92 #define _LTAG_FIXEDMEM32RANGE 0x86 94 93 95 94 static unsigned char isapnp_checksum_value; 96 - static DECLARE_MUTEX(isapnp_cfg_mutex); 95 + static DEFINE_MUTEX(isapnp_cfg_mutex); 97 96 static int isapnp_detected; 98 97 static int isapnp_csn_count; 99 98 ··· 904 903 { 905 904 if (csn < 1 || csn > isapnp_csn_count || logdev > 10) 906 905 return -EINVAL; 907 - down(&isapnp_cfg_mutex); 906 + mutex_lock(&isapnp_cfg_mutex); 908 907 isapnp_wait(); 909 908 isapnp_key(); 910 909 isapnp_wake(csn); ··· 930 929 int isapnp_cfg_end(void) 931 930 { 932 931 isapnp_wait(); 933 - up(&isapnp_cfg_mutex); 932 + mutex_unlock(&isapnp_cfg_mutex); 934 933 return 0; 935 934 } 936 935
+20 -19
drivers/s390/char/raw3270.c
··· 28 28 #include <linux/major.h> 29 29 #include <linux/kdev_t.h> 30 30 #include <linux/device.h> 31 + #include <linux/mutex.h> 31 32 32 33 struct class *class3270; 33 34 ··· 60 59 #define RAW3270_FLAGS_CONSOLE 8 /* Device is the console. */ 61 60 62 61 /* Semaphore to protect global data of raw3270 (devices, views, etc). */ 63 - static DECLARE_MUTEX(raw3270_sem); 62 + static DEFINE_MUTEX(raw3270_mutex); 64 63 65 64 /* List of 3270 devices. */ 66 65 static struct list_head raw3270_devices = LIST_HEAD_INIT(raw3270_devices); ··· 816 815 * number for it. Note: there is no device with minor 0, 817 816 * see special case for fs3270.c:fs3270_open(). 818 817 */ 819 - down(&raw3270_sem); 818 + mutex_lock(&raw3270_mutex); 820 819 /* Keep the list sorted. */ 821 820 minor = RAW3270_FIRSTMINOR; 822 821 rp->minor = -1; ··· 833 832 rp->minor = minor; 834 833 list_add_tail(&rp->list, &raw3270_devices); 835 834 } 836 - up(&raw3270_sem); 835 + mutex_unlock(&raw3270_mutex); 837 836 /* No free minor number? Then give up. */ 838 837 if (rp->minor == -1) 839 838 return -EUSERS; ··· 1004 1003 1005 1004 if (minor <= 0) 1006 1005 return -ENODEV; 1007 - down(&raw3270_sem); 1006 + mutex_lock(&raw3270_mutex); 1008 1007 rc = -ENODEV; 1009 1008 list_for_each_entry(rp, &raw3270_devices, list) { 1010 1009 if (rp->minor != minor) ··· 1025 1024 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); 1026 1025 break; 1027 1026 } 1028 - up(&raw3270_sem); 1027 + mutex_unlock(&raw3270_mutex); 1029 1028 return rc; 1030 1029 } 1031 1030 ··· 1039 1038 struct raw3270_view *view, *tmp; 1040 1039 unsigned long flags; 1041 1040 1042 - down(&raw3270_sem); 1041 + mutex_lock(&raw3270_mutex); 1043 1042 view = ERR_PTR(-ENODEV); 1044 1043 list_for_each_entry(rp, &raw3270_devices, list) { 1045 1044 if (rp->minor != minor) ··· 1058 1057 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); 1059 1058 break; 1060 1059 } 1061 - up(&raw3270_sem); 1060 + mutex_unlock(&raw3270_mutex); 1062 1061 return view; 1063 1062 } 1064 1063 ··· 1105 1104 struct ccw_device *cdev; 1106 1105 1107 1106 /* Remove from device chain. */ 1108 - down(&raw3270_sem); 1107 + mutex_lock(&raw3270_mutex); 1109 1108 if (rp->clttydev) 1110 1109 class_device_destroy(class3270, 1111 1110 MKDEV(IBM_TTY3270_MAJOR, rp->minor)); ··· 1113 1112 class_device_destroy(class3270, 1114 1113 MKDEV(IBM_FS3270_MAJOR, rp->minor)); 1115 1114 list_del_init(&rp->list); 1116 - up(&raw3270_sem); 1115 + mutex_unlock(&raw3270_mutex); 1117 1116 1118 1117 /* Disconnect from ccw_device. */ 1119 1118 cdev = rp->cdev; ··· 1209 1208 if (!np) 1210 1209 return -ENOMEM; 1211 1210 np->notifier = notifier; 1212 - down(&raw3270_sem); 1211 + mutex_lock(&raw3270_mutex); 1213 1212 list_add_tail(&np->list, &raw3270_notifier); 1214 1213 list_for_each_entry(rp, &raw3270_devices, list) { 1215 1214 get_device(&rp->cdev->dev); 1216 1215 notifier(rp->minor, 1); 1217 1216 } 1218 - up(&raw3270_sem); 1217 + mutex_unlock(&raw3270_mutex); 1219 1218 return 0; 1220 1219 } 1221 1220 ··· 1223 1222 { 1224 1223 struct raw3270_notifier *np; 1225 1224 1226 - down(&raw3270_sem); 1225 + mutex_lock(&raw3270_mutex); 1227 1226 list_for_each_entry(np, &raw3270_notifier, list) 1228 1227 if (np->notifier == notifier) { 1229 1228 list_del(&np->list); 1230 1229 kfree(np); 1231 1230 break; 1232 1231 } 1233 - up(&raw3270_sem); 1232 + mutex_unlock(&raw3270_mutex); 1234 1233 } 1235 1234 1236 1235 /* ··· 1257 1256 goto failure; 1258 1257 raw3270_create_attributes(rp); 1259 1258 set_bit(RAW3270_FLAGS_READY, &rp->flags); 1260 - down(&raw3270_sem); 1259 + mutex_lock(&raw3270_mutex); 1261 1260 list_for_each_entry(np, &raw3270_notifier, list) 1262 1261 np->notifier(rp->minor, 1); 1263 - up(&raw3270_sem); 1262 + mutex_unlock(&raw3270_mutex); 1264 1263 return 0; 1265 1264 1266 1265 failure: ··· 1308 1307 } 1309 1308 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); 1310 1309 1311 - down(&raw3270_sem); 1310 + mutex_lock(&raw3270_mutex); 1312 1311 list_for_each_entry(np, &raw3270_notifier, list) 1313 1312 np->notifier(rp->minor, 0); 1314 - up(&raw3270_sem); 1313 + mutex_unlock(&raw3270_mutex); 1315 1314 1316 1315 /* Reset 3270 device. */ 1317 1316 raw3270_reset_device(rp); ··· 1371 1370 rc = ccw_driver_register(&raw3270_ccw_driver); 1372 1371 if (rc == 0) { 1373 1372 /* Create attributes for early (= console) device. */ 1374 - down(&raw3270_sem); 1373 + mutex_lock(&raw3270_mutex); 1375 1374 class3270 = class_create(THIS_MODULE, "3270"); 1376 1375 list_for_each_entry(rp, &raw3270_devices, list) { 1377 1376 get_device(&rp->cdev->dev); 1378 1377 raw3270_create_attributes(rp); 1379 1378 } 1380 - up(&raw3270_sem); 1379 + mutex_unlock(&raw3270_mutex); 1381 1380 } 1382 1381 return rc; 1383 1382 }
+11 -10
drivers/telephony/phonedev.c
··· 29 29 #include <linux/kmod.h> 30 30 #include <linux/sem.h> 31 31 #include <linux/devfs_fs_kernel.h> 32 + #include <linux/mutex.h> 32 33 33 34 #define PHONE_NUM_DEVICES 256 34 35 ··· 38 37 */ 39 38 40 39 static struct phone_device *phone_device[PHONE_NUM_DEVICES]; 41 - static DECLARE_MUTEX(phone_lock); 40 + static DEFINE_MUTEX(phone_lock); 42 41 43 42 /* 44 43 * Open a phone device. ··· 54 53 if (minor >= PHONE_NUM_DEVICES) 55 54 return -ENODEV; 56 55 57 - down(&phone_lock); 56 + mutex_lock(&phone_lock); 58 57 p = phone_device[minor]; 59 58 if (p) 60 59 new_fops = fops_get(p->f_op); 61 60 if (!new_fops) { 62 - up(&phone_lock); 61 + mutex_unlock(&phone_lock); 63 62 request_module("char-major-%d-%d", PHONE_MAJOR, minor); 64 - down(&phone_lock); 63 + mutex_lock(&phone_lock); 65 64 p = phone_device[minor]; 66 65 if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL) 67 66 { ··· 79 78 } 80 79 fops_put(old_fops); 81 80 end: 82 - up(&phone_lock); 81 + mutex_unlock(&phone_lock); 83 82 return err; 84 83 } 85 84 ··· 101 100 end = unit + 1; /* enter the loop at least one time */ 102 101 } 103 102 104 - down(&phone_lock); 103 + mutex_lock(&phone_lock); 105 104 for (i = base; i < end; i++) { 106 105 if (phone_device[i] == NULL) { 107 106 phone_device[i] = p; 108 107 p->minor = i; 109 108 devfs_mk_cdev(MKDEV(PHONE_MAJOR,i), 110 109 S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i); 111 - up(&phone_lock); 110 + mutex_unlock(&phone_lock); 112 111 return 0; 113 112 } 114 113 } 115 - up(&phone_lock); 114 + mutex_unlock(&phone_lock); 116 115 return -ENFILE; 117 116 } 118 117 ··· 122 121 123 122 void phone_unregister_device(struct phone_device *pfd) 124 123 { 125 - down(&phone_lock); 124 + mutex_lock(&phone_lock); 126 125 if (phone_device[pfd->minor] != pfd) 127 126 panic("phone: bad unregister"); 128 127 devfs_remove("phone/%d", pfd->minor); 129 128 phone_device[pfd->minor] = NULL; 130 - up(&phone_lock); 129 + mutex_unlock(&phone_lock); 131 130 } 132 131 133 132
+6 -5
net/ipv4/ipvs/ip_vs_ctl.c
··· 34 34 35 35 #include <linux/netfilter.h> 36 36 #include <linux/netfilter_ipv4.h> 37 + #include <linux/mutex.h> 37 38 38 39 #include <net/ip.h> 39 40 #include <net/route.h> ··· 45 44 #include <net/ip_vs.h> 46 45 47 46 /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ 48 - static DECLARE_MUTEX(__ip_vs_mutex); 47 + static DEFINE_MUTEX(__ip_vs_mutex); 49 48 50 49 /* lock for service table */ 51 50 static DEFINE_RWLOCK(__ip_vs_svc_lock); ··· 1951 1950 /* increase the module use count */ 1952 1951 ip_vs_use_count_inc(); 1953 1952 1954 - if (down_interruptible(&__ip_vs_mutex)) { 1953 + if (mutex_lock_interruptible(&__ip_vs_mutex)) { 1955 1954 ret = -ERESTARTSYS; 1956 1955 goto out_dec; 1957 1956 } ··· 2042 2041 ip_vs_service_put(svc); 2043 2042 2044 2043 out_unlock: 2045 - up(&__ip_vs_mutex); 2044 + mutex_unlock(&__ip_vs_mutex); 2046 2045 out_dec: 2047 2046 /* decrease the module use count */ 2048 2047 ip_vs_use_count_dec(); ··· 2212 2211 if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) 2213 2212 return -EFAULT; 2214 2213 2215 - if (down_interruptible(&__ip_vs_mutex)) 2214 + if (mutex_lock_interruptible(&__ip_vs_mutex)) 2216 2215 return -ERESTARTSYS; 2217 2216 2218 2217 switch (cmd) { ··· 2331 2330 } 2332 2331 2333 2332 out: 2334 - up(&__ip_vs_mutex); 2333 + mutex_unlock(&__ip_vs_mutex); 2335 2334 return ret; 2336 2335 } 2337 2336
+5 -4
net/ipv4/netfilter/ipt_hashlimit.c
··· 40 40 41 41 /* FIXME: this is just for IP_NF_ASSERRT */ 42 42 #include <linux/netfilter_ipv4/ip_conntrack.h> 43 + #include <linux/mutex.h> 43 44 44 45 MODULE_LICENSE("GPL"); 45 46 MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); ··· 93 92 }; 94 93 95 94 static DEFINE_SPINLOCK(hashlimit_lock); /* protects htables list */ 96 - static DECLARE_MUTEX(hlimit_mutex); /* additional checkentry protection */ 95 + static DEFINE_MUTEX(hlimit_mutex); /* additional checkentry protection */ 97 96 static HLIST_HEAD(hashlimit_htables); 98 97 static kmem_cache_t *hashlimit_cachep __read_mostly; 99 98 ··· 543 542 * call vmalloc, and that can sleep. And we cannot just re-search 544 543 * the list of htable's in htable_create(), since then we would 545 544 * create duplicate proc files. -HW */ 546 - down(&hlimit_mutex); 545 + mutex_lock(&hlimit_mutex); 547 546 r->hinfo = htable_find_get(r->name); 548 547 if (!r->hinfo && (htable_create(r) != 0)) { 549 - up(&hlimit_mutex); 548 + mutex_unlock(&hlimit_mutex); 550 549 return 0; 551 550 } 552 - up(&hlimit_mutex); 551 + mutex_unlock(&hlimit_mutex); 553 552 554 553 /* Ugly hack: For SMP, we only want to use one set */ 555 554 r->u.master = r;
+5 -4
net/netlink/genetlink.c
··· 13 13 #include <linux/socket.h> 14 14 #include <linux/string.h> 15 15 #include <linux/skbuff.h> 16 + #include <linux/mutex.h> 16 17 #include <net/sock.h> 17 18 #include <net/genetlink.h> 18 19 19 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 24 static void genl_lock(void) 24 25 { 25 - down(&genl_sem); 26 + mutex_lock(&genl_mutex); 26 27 } 27 28 28 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 34 static void genl_unlock(void) 34 35 { 35 - up(&genl_sem); 36 + mutex_unlock(&genl_mutex); 36 37 37 38 if (genl_sock && genl_sock->sk_receive_queue.qlen) 38 39 genl_sock->sk_data_ready(genl_sock, 0);