diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/loop.c | 31 | ||||
-rw-r--r-- | drivers/block/sx8.c | 12 | ||||
-rw-r--r-- | drivers/char/mem.c | 4 | ||||
-rw-r--r-- | drivers/char/sysrq.c | 19 | ||||
-rw-r--r-- | drivers/char/watchdog/cpu5wdt.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 4 | ||||
-rw-r--r-- | drivers/ide/ide.c | 8 | ||||
-rw-r--r-- | drivers/isdn/capi/capifs.c | 6 | ||||
-rw-r--r-- | drivers/md/dm.c | 4 | ||||
-rw-r--r-- | drivers/md/md.c | 8 | ||||
-rw-r--r-- | drivers/pci/proc.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/inode.c | 28 | ||||
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/inode.c | 4 |
14 files changed, 81 insertions, 64 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index a452b13620a2..864729046e22 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -215,7 +215,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec, | |||
215 | unsigned offset, bv_offs; | 215 | unsigned offset, bv_offs; |
216 | int len, ret; | 216 | int len, ret; |
217 | 217 | ||
218 | down(&mapping->host->i_sem); | 218 | mutex_lock(&mapping->host->i_mutex); |
219 | index = pos >> PAGE_CACHE_SHIFT; | 219 | index = pos >> PAGE_CACHE_SHIFT; |
220 | offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1); | 220 | offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1); |
221 | bv_offs = bvec->bv_offset; | 221 | bv_offs = bvec->bv_offset; |
@@ -278,7 +278,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec, | |||
278 | } | 278 | } |
279 | ret = 0; | 279 | ret = 0; |
280 | out: | 280 | out: |
281 | up(&mapping->host->i_sem); | 281 | mutex_unlock(&mapping->host->i_mutex); |
282 | return ret; | 282 | return ret; |
283 | unlock: | 283 | unlock: |
284 | unlock_page(page); | 284 | unlock_page(page); |
@@ -527,12 +527,12 @@ static int loop_make_request(request_queue_t *q, struct bio *old_bio) | |||
527 | lo->lo_pending++; | 527 | lo->lo_pending++; |
528 | loop_add_bio(lo, old_bio); | 528 | loop_add_bio(lo, old_bio); |
529 | spin_unlock_irq(&lo->lo_lock); | 529 | spin_unlock_irq(&lo->lo_lock); |
530 | up(&lo->lo_bh_mutex); | 530 | complete(&lo->lo_bh_done); |
531 | return 0; | 531 | return 0; |
532 | 532 | ||
533 | out: | 533 | out: |
534 | if (lo->lo_pending == 0) | 534 | if (lo->lo_pending == 0) |
535 | up(&lo->lo_bh_mutex); | 535 | complete(&lo->lo_bh_done); |
536 | spin_unlock_irq(&lo->lo_lock); | 536 | spin_unlock_irq(&lo->lo_lock); |
537 | bio_io_error(old_bio, old_bio->bi_size); | 537 | bio_io_error(old_bio, old_bio->bi_size); |
538 | return 0; | 538 | return 0; |
@@ -593,23 +593,20 @@ static int loop_thread(void *data) | |||
593 | lo->lo_pending = 1; | 593 | lo->lo_pending = 1; |
594 | 594 | ||
595 | /* | 595 | /* |
596 | * up sem, we are running | 596 | * complete it, we are running |
597 | */ | 597 | */ |
598 | up(&lo->lo_sem); | 598 | complete(&lo->lo_done); |
599 | 599 | ||
600 | for (;;) { | 600 | for (;;) { |
601 | int pending; | 601 | int pending; |
602 | 602 | ||
603 | /* | 603 | if (wait_for_completion_interruptible(&lo->lo_bh_done)) |
604 | * interruptible just to not contribute to load avg | ||
605 | */ | ||
606 | if (down_interruptible(&lo->lo_bh_mutex)) | ||
607 | continue; | 604 | continue; |
608 | 605 | ||
609 | spin_lock_irq(&lo->lo_lock); | 606 | spin_lock_irq(&lo->lo_lock); |
610 | 607 | ||
611 | /* | 608 | /* |
612 | * could be upped because of tear-down, not pending work | 609 | * could be completed because of tear-down, not pending work |
613 | */ | 610 | */ |
614 | if (unlikely(!lo->lo_pending)) { | 611 | if (unlikely(!lo->lo_pending)) { |
615 | spin_unlock_irq(&lo->lo_lock); | 612 | spin_unlock_irq(&lo->lo_lock); |
@@ -632,7 +629,7 @@ static int loop_thread(void *data) | |||
632 | break; | 629 | break; |
633 | } | 630 | } |
634 | 631 | ||
635 | up(&lo->lo_sem); | 632 | complete(&lo->lo_done); |
636 | return 0; | 633 | return 0; |
637 | } | 634 | } |
638 | 635 | ||
@@ -843,7 +840,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, | |||
843 | set_blocksize(bdev, lo_blocksize); | 840 | set_blocksize(bdev, lo_blocksize); |
844 | 841 | ||
845 | kernel_thread(loop_thread, lo, CLONE_KERNEL); | 842 | kernel_thread(loop_thread, lo, CLONE_KERNEL); |
846 | down(&lo->lo_sem); | 843 | wait_for_completion(&lo->lo_done); |
847 | return 0; | 844 | return 0; |
848 | 845 | ||
849 | out_putf: | 846 | out_putf: |
@@ -909,10 +906,10 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) | |||
909 | lo->lo_state = Lo_rundown; | 906 | lo->lo_state = Lo_rundown; |
910 | lo->lo_pending--; | 907 | lo->lo_pending--; |
911 | if (!lo->lo_pending) | 908 | if (!lo->lo_pending) |
912 | up(&lo->lo_bh_mutex); | 909 | complete(&lo->lo_bh_done); |
913 | spin_unlock_irq(&lo->lo_lock); | 910 | spin_unlock_irq(&lo->lo_lock); |
914 | 911 | ||
915 | down(&lo->lo_sem); | 912 | wait_for_completion(&lo->lo_done); |
916 | 913 | ||
917 | lo->lo_backing_file = NULL; | 914 | lo->lo_backing_file = NULL; |
918 | 915 | ||
@@ -1289,8 +1286,8 @@ static int __init loop_init(void) | |||
1289 | if (!lo->lo_queue) | 1286 | if (!lo->lo_queue) |
1290 | goto out_mem4; | 1287 | goto out_mem4; |
1291 | init_MUTEX(&lo->lo_ctl_mutex); | 1288 | init_MUTEX(&lo->lo_ctl_mutex); |
1292 | init_MUTEX_LOCKED(&lo->lo_sem); | 1289 | init_completion(&lo->lo_done); |
1293 | init_MUTEX_LOCKED(&lo->lo_bh_mutex); | 1290 | init_completion(&lo->lo_bh_done); |
1294 | lo->lo_number = i; | 1291 | lo->lo_number = i; |
1295 | spin_lock_init(&lo->lo_lock); | 1292 | spin_lock_init(&lo->lo_lock); |
1296 | disk->major = LOOP_MAJOR; | 1293 | disk->major = LOOP_MAJOR; |
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index c0cdc182a8b0..4bdf95716e2b 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c | |||
@@ -27,8 +27,8 @@ | |||
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/hdreg.h> | 28 | #include <linux/hdreg.h> |
29 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
30 | #include <linux/completion.h> | ||
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |
31 | #include <asm/semaphore.h> | ||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | 33 | ||
34 | #if 0 | 34 | #if 0 |
@@ -303,7 +303,7 @@ struct carm_host { | |||
303 | 303 | ||
304 | struct work_struct fsm_task; | 304 | struct work_struct fsm_task; |
305 | 305 | ||
306 | struct semaphore probe_sem; | 306 | struct completion probe_comp; |
307 | }; | 307 | }; |
308 | 308 | ||
309 | struct carm_response { | 309 | struct carm_response { |
@@ -1346,7 +1346,7 @@ static void carm_fsm_task (void *_data) | |||
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | case HST_PROBE_FINISHED: | 1348 | case HST_PROBE_FINISHED: |
1349 | up(&host->probe_sem); | 1349 | complete(&host->probe_comp); |
1350 | break; | 1350 | break; |
1351 | 1351 | ||
1352 | case HST_ERROR: | 1352 | case HST_ERROR: |
@@ -1622,7 +1622,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1622 | host->flags = pci_dac ? FL_DAC : 0; | 1622 | host->flags = pci_dac ? FL_DAC : 0; |
1623 | spin_lock_init(&host->lock); | 1623 | spin_lock_init(&host->lock); |
1624 | INIT_WORK(&host->fsm_task, carm_fsm_task, host); | 1624 | INIT_WORK(&host->fsm_task, carm_fsm_task, host); |
1625 | init_MUTEX_LOCKED(&host->probe_sem); | 1625 | init_completion(&host->probe_comp); |
1626 | 1626 | ||
1627 | for (i = 0; i < ARRAY_SIZE(host->req); i++) | 1627 | for (i = 0; i < ARRAY_SIZE(host->req); i++) |
1628 | host->req[i].tag = i; | 1628 | host->req[i].tag = i; |
@@ -1691,8 +1691,8 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1691 | if (rc) | 1691 | if (rc) |
1692 | goto err_out_free_irq; | 1692 | goto err_out_free_irq; |
1693 | 1693 | ||
1694 | DPRINTK("waiting for probe_sem\n"); | 1694 | DPRINTK("waiting for probe_comp\n"); |
1695 | down(&host->probe_sem); | 1695 | wait_for_completion(&host->probe_comp); |
1696 | 1696 | ||
1697 | printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n", | 1697 | printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n", |
1698 | host->name, pci_name(pdev), (int) CARM_MAX_PORTS, | 1698 | host->name, pci_name(pdev), (int) CARM_MAX_PORTS, |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 5b2d18035073..704c3c07f0ab 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -741,7 +741,7 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig) | |||
741 | { | 741 | { |
742 | loff_t ret; | 742 | loff_t ret; |
743 | 743 | ||
744 | down(&file->f_dentry->d_inode->i_sem); | 744 | mutex_lock(&file->f_dentry->d_inode->i_mutex); |
745 | switch (orig) { | 745 | switch (orig) { |
746 | case 0: | 746 | case 0: |
747 | file->f_pos = offset; | 747 | file->f_pos = offset; |
@@ -756,7 +756,7 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig) | |||
756 | default: | 756 | default: |
757 | ret = -EINVAL; | 757 | ret = -EINVAL; |
758 | } | 758 | } |
759 | up(&file->f_dentry->d_inode->i_sem); | 759 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); |
760 | return ret; | 760 | return ret; |
761 | } | 761 | } |
762 | 762 | ||
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 145275ebdd7e..5765f672e853 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -153,6 +153,21 @@ static struct sysrq_key_op sysrq_mountro_op = { | |||
153 | 153 | ||
154 | /* END SYNC SYSRQ HANDLERS BLOCK */ | 154 | /* END SYNC SYSRQ HANDLERS BLOCK */ |
155 | 155 | ||
156 | #ifdef CONFIG_DEBUG_MUTEXES | ||
157 | |||
158 | static void | ||
159 | sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, struct tty_struct *tty) | ||
160 | { | ||
161 | mutex_debug_show_all_locks(); | ||
162 | } | ||
163 | |||
164 | static struct sysrq_key_op sysrq_showlocks_op = { | ||
165 | .handler = sysrq_handle_showlocks, | ||
166 | .help_msg = "show-all-locks(D)", | ||
167 | .action_msg = "Show Locks Held", | ||
168 | }; | ||
169 | |||
170 | #endif | ||
156 | 171 | ||
157 | /* SHOW SYSRQ HANDLERS BLOCK */ | 172 | /* SHOW SYSRQ HANDLERS BLOCK */ |
158 | 173 | ||
@@ -294,7 +309,11 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = { | |||
294 | #else | 309 | #else |
295 | /* c */ NULL, | 310 | /* c */ NULL, |
296 | #endif | 311 | #endif |
312 | #ifdef CONFIG_DEBUG_MUTEXES | ||
313 | /* d */ &sysrq_showlocks_op, | ||
314 | #else | ||
297 | /* d */ NULL, | 315 | /* d */ NULL, |
316 | #endif | ||
298 | /* e */ &sysrq_term_op, | 317 | /* e */ &sysrq_term_op, |
299 | /* f */ &sysrq_moom_op, | 318 | /* f */ &sysrq_moom_op, |
300 | /* g */ NULL, | 319 | /* g */ NULL, |
diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c index e75045fe2641..3e8410b5a65e 100644 --- a/drivers/char/watchdog/cpu5wdt.c +++ b/drivers/char/watchdog/cpu5wdt.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/ioport.h> | 29 | #include <linux/ioport.h> |
30 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
31 | #include <linux/completion.h> | ||
31 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
@@ -57,7 +58,7 @@ static int ticks = 10000; | |||
57 | /* some device data */ | 58 | /* some device data */ |
58 | 59 | ||
59 | static struct { | 60 | static struct { |
60 | struct semaphore stop; | 61 | struct completion stop; |
61 | volatile int running; | 62 | volatile int running; |
62 | struct timer_list timer; | 63 | struct timer_list timer; |
63 | volatile int queue; | 64 | volatile int queue; |
@@ -85,7 +86,7 @@ static void cpu5wdt_trigger(unsigned long unused) | |||
85 | } | 86 | } |
86 | else { | 87 | else { |
87 | /* ticks doesn't matter anyway */ | 88 | /* ticks doesn't matter anyway */ |
88 | up(&cpu5wdt_device.stop); | 89 | complete(&cpu5wdt_device.stop); |
89 | } | 90 | } |
90 | 91 | ||
91 | } | 92 | } |
@@ -239,7 +240,7 @@ static int __devinit cpu5wdt_init(void) | |||
239 | if ( !val ) | 240 | if ( !val ) |
240 | printk(KERN_INFO PFX "sorry, was my fault\n"); | 241 | printk(KERN_INFO PFX "sorry, was my fault\n"); |
241 | 242 | ||
242 | init_MUTEX_LOCKED(&cpu5wdt_device.stop); | 243 | init_completion(&cpu5wdt_device.stop); |
243 | cpu5wdt_device.queue = 0; | 244 | cpu5wdt_device.queue = 0; |
244 | 245 | ||
245 | clear_bit(0, &cpu5wdt_device.inuse); | 246 | clear_bit(0, &cpu5wdt_device.inuse); |
@@ -269,7 +270,7 @@ static void __devexit cpu5wdt_exit(void) | |||
269 | { | 270 | { |
270 | if ( cpu5wdt_device.queue ) { | 271 | if ( cpu5wdt_device.queue ) { |
271 | cpu5wdt_device.queue = 0; | 272 | cpu5wdt_device.queue = 0; |
272 | down(&cpu5wdt_device.stop); | 273 | wait_for_completion(&cpu5wdt_device.stop); |
273 | } | 274 | } |
274 | 275 | ||
275 | misc_deregister(&cpu5wdt_misc); | 276 | misc_deregister(&cpu5wdt_misc); |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 1ddaa71a8f45..7cb2d86601db 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -655,7 +655,7 @@ static void hwif_release_dev (struct device *dev) | |||
655 | { | 655 | { |
656 | ide_hwif_t *hwif = container_of(dev, ide_hwif_t, gendev); | 656 | ide_hwif_t *hwif = container_of(dev, ide_hwif_t, gendev); |
657 | 657 | ||
658 | up(&hwif->gendev_rel_sem); | 658 | complete(&hwif->gendev_rel_comp); |
659 | } | 659 | } |
660 | 660 | ||
661 | static void hwif_register (ide_hwif_t *hwif) | 661 | static void hwif_register (ide_hwif_t *hwif) |
@@ -1327,7 +1327,7 @@ static void drive_release_dev (struct device *dev) | |||
1327 | drive->queue = NULL; | 1327 | drive->queue = NULL; |
1328 | spin_unlock_irq(&ide_lock); | 1328 | spin_unlock_irq(&ide_lock); |
1329 | 1329 | ||
1330 | up(&drive->gendev_rel_sem); | 1330 | complete(&drive->gendev_rel_comp); |
1331 | } | 1331 | } |
1332 | 1332 | ||
1333 | /* | 1333 | /* |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index b069b13b75a7..ec5a4cb173b0 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -222,7 +222,7 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index) | |||
222 | hwif->mwdma_mask = 0x80; /* disable all mwdma */ | 222 | hwif->mwdma_mask = 0x80; /* disable all mwdma */ |
223 | hwif->swdma_mask = 0x80; /* disable all swdma */ | 223 | hwif->swdma_mask = 0x80; /* disable all swdma */ |
224 | 224 | ||
225 | sema_init(&hwif->gendev_rel_sem, 0); | 225 | init_completion(&hwif->gendev_rel_comp); |
226 | 226 | ||
227 | default_hwif_iops(hwif); | 227 | default_hwif_iops(hwif); |
228 | default_hwif_transport(hwif); | 228 | default_hwif_transport(hwif); |
@@ -245,7 +245,7 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index) | |||
245 | drive->is_flash = 0; | 245 | drive->is_flash = 0; |
246 | drive->vdma = 0; | 246 | drive->vdma = 0; |
247 | INIT_LIST_HEAD(&drive->list); | 247 | INIT_LIST_HEAD(&drive->list); |
248 | sema_init(&drive->gendev_rel_sem, 0); | 248 | init_completion(&drive->gendev_rel_comp); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
@@ -602,7 +602,7 @@ void ide_unregister(unsigned int index) | |||
602 | } | 602 | } |
603 | spin_unlock_irq(&ide_lock); | 603 | spin_unlock_irq(&ide_lock); |
604 | device_unregister(&drive->gendev); | 604 | device_unregister(&drive->gendev); |
605 | down(&drive->gendev_rel_sem); | 605 | wait_for_completion(&drive->gendev_rel_comp); |
606 | spin_lock_irq(&ide_lock); | 606 | spin_lock_irq(&ide_lock); |
607 | } | 607 | } |
608 | hwif->present = 0; | 608 | hwif->present = 0; |
@@ -662,7 +662,7 @@ void ide_unregister(unsigned int index) | |||
662 | /* More messed up locking ... */ | 662 | /* More messed up locking ... */ |
663 | spin_unlock_irq(&ide_lock); | 663 | spin_unlock_irq(&ide_lock); |
664 | device_unregister(&hwif->gendev); | 664 | device_unregister(&hwif->gendev); |
665 | down(&hwif->gendev_rel_sem); | 665 | wait_for_completion(&hwif->gendev_rel_comp); |
666 | 666 | ||
667 | /* | 667 | /* |
668 | * Remove us from the kernel's knowledge | 668 | * Remove us from the kernel's knowledge |
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c index 207cae366256..0a37aded4b54 100644 --- a/drivers/isdn/capi/capifs.c +++ b/drivers/isdn/capi/capifs.c | |||
@@ -138,7 +138,7 @@ static struct dentry *get_node(int num) | |||
138 | { | 138 | { |
139 | char s[10]; | 139 | char s[10]; |
140 | struct dentry *root = capifs_root; | 140 | struct dentry *root = capifs_root; |
141 | down(&root->d_inode->i_sem); | 141 | mutex_lock(&root->d_inode->i_mutex); |
142 | return lookup_one_len(s, root, sprintf(s, "%d", num)); | 142 | return lookup_one_len(s, root, sprintf(s, "%d", num)); |
143 | } | 143 | } |
144 | 144 | ||
@@ -159,7 +159,7 @@ void capifs_new_ncci(unsigned int number, dev_t device) | |||
159 | dentry = get_node(number); | 159 | dentry = get_node(number); |
160 | if (!IS_ERR(dentry) && !dentry->d_inode) | 160 | if (!IS_ERR(dentry) && !dentry->d_inode) |
161 | d_instantiate(dentry, inode); | 161 | d_instantiate(dentry, inode); |
162 | up(&capifs_root->d_inode->i_sem); | 162 | mutex_unlock(&capifs_root->d_inode->i_mutex); |
163 | } | 163 | } |
164 | 164 | ||
165 | void capifs_free_ncci(unsigned int number) | 165 | void capifs_free_ncci(unsigned int number) |
@@ -175,7 +175,7 @@ void capifs_free_ncci(unsigned int number) | |||
175 | } | 175 | } |
176 | dput(dentry); | 176 | dput(dentry); |
177 | } | 177 | } |
178 | up(&capifs_root->d_inode->i_sem); | 178 | mutex_unlock(&capifs_root->d_inode->i_mutex); |
179 | } | 179 | } |
180 | 180 | ||
181 | static int __init capifs_init(void) | 181 | static int __init capifs_init(void) |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 0e481512f918..5c210b0a4cb0 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -837,9 +837,9 @@ static void __set_size(struct mapped_device *md, sector_t size) | |||
837 | { | 837 | { |
838 | set_capacity(md->disk, size); | 838 | set_capacity(md->disk, size); |
839 | 839 | ||
840 | down(&md->suspended_bdev->bd_inode->i_sem); | 840 | mutex_lock(&md->suspended_bdev->bd_inode->i_mutex); |
841 | i_size_write(md->suspended_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); | 841 | i_size_write(md->suspended_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
842 | up(&md->suspended_bdev->bd_inode->i_sem); | 842 | mutex_unlock(&md->suspended_bdev->bd_inode->i_mutex); |
843 | } | 843 | } |
844 | 844 | ||
845 | static int __bind(struct mapped_device *md, struct dm_table *t) | 845 | static int __bind(struct mapped_device *md, struct dm_table *t) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index e423a16ba3c9..0302723fa21f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3460,9 +3460,9 @@ static int update_size(mddev_t *mddev, unsigned long size) | |||
3460 | 3460 | ||
3461 | bdev = bdget_disk(mddev->gendisk, 0); | 3461 | bdev = bdget_disk(mddev->gendisk, 0); |
3462 | if (bdev) { | 3462 | if (bdev) { |
3463 | down(&bdev->bd_inode->i_sem); | 3463 | mutex_lock(&bdev->bd_inode->i_mutex); |
3464 | i_size_write(bdev->bd_inode, mddev->array_size << 10); | 3464 | i_size_write(bdev->bd_inode, mddev->array_size << 10); |
3465 | up(&bdev->bd_inode->i_sem); | 3465 | mutex_unlock(&bdev->bd_inode->i_mutex); |
3466 | bdput(bdev); | 3466 | bdput(bdev); |
3467 | } | 3467 | } |
3468 | } | 3468 | } |
@@ -3486,9 +3486,9 @@ static int update_raid_disks(mddev_t *mddev, int raid_disks) | |||
3486 | 3486 | ||
3487 | bdev = bdget_disk(mddev->gendisk, 0); | 3487 | bdev = bdget_disk(mddev->gendisk, 0); |
3488 | if (bdev) { | 3488 | if (bdev) { |
3489 | down(&bdev->bd_inode->i_sem); | 3489 | mutex_lock(&bdev->bd_inode->i_mutex); |
3490 | i_size_write(bdev->bd_inode, mddev->array_size << 10); | 3490 | i_size_write(bdev->bd_inode, mddev->array_size << 10); |
3491 | up(&bdev->bd_inode->i_sem); | 3491 | mutex_unlock(&bdev->bd_inode->i_mutex); |
3492 | bdput(bdev); | 3492 | bdput(bdev); |
3493 | } | 3493 | } |
3494 | } | 3494 | } |
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 9eb465727fce..9cb6dd0834be 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -25,7 +25,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | |||
25 | loff_t new = -1; | 25 | loff_t new = -1; |
26 | struct inode *inode = file->f_dentry->d_inode; | 26 | struct inode *inode = file->f_dentry->d_inode; |
27 | 27 | ||
28 | down(&inode->i_sem); | 28 | mutex_lock(&inode->i_mutex); |
29 | switch (whence) { | 29 | switch (whence) { |
30 | case 0: | 30 | case 0: |
31 | new = off; | 31 | new = off; |
@@ -41,7 +41,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | |||
41 | new = -EINVAL; | 41 | new = -EINVAL; |
42 | else | 42 | else |
43 | file->f_pos = new; | 43 | file->f_pos = new; |
44 | up(&inode->i_sem); | 44 | mutex_unlock(&inode->i_mutex); |
45 | return new; | 45 | return new; |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 4ddc453023a2..3cf945cc5b9a 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -184,13 +184,13 @@ static void update_bus(struct dentry *bus) | |||
184 | bus->d_inode->i_gid = busgid; | 184 | bus->d_inode->i_gid = busgid; |
185 | bus->d_inode->i_mode = S_IFDIR | busmode; | 185 | bus->d_inode->i_mode = S_IFDIR | busmode; |
186 | 186 | ||
187 | down(&bus->d_inode->i_sem); | 187 | mutex_lock(&bus->d_inode->i_mutex); |
188 | 188 | ||
189 | list_for_each_entry(dev, &bus->d_subdirs, d_u.d_child) | 189 | list_for_each_entry(dev, &bus->d_subdirs, d_u.d_child) |
190 | if (dev->d_inode) | 190 | if (dev->d_inode) |
191 | update_dev(dev); | 191 | update_dev(dev); |
192 | 192 | ||
193 | up(&bus->d_inode->i_sem); | 193 | mutex_unlock(&bus->d_inode->i_mutex); |
194 | } | 194 | } |
195 | 195 | ||
196 | static void update_sb(struct super_block *sb) | 196 | static void update_sb(struct super_block *sb) |
@@ -201,7 +201,7 @@ static void update_sb(struct super_block *sb) | |||
201 | if (!root) | 201 | if (!root) |
202 | return; | 202 | return; |
203 | 203 | ||
204 | down(&root->d_inode->i_sem); | 204 | mutex_lock(&root->d_inode->i_mutex); |
205 | 205 | ||
206 | list_for_each_entry(bus, &root->d_subdirs, d_u.d_child) { | 206 | list_for_each_entry(bus, &root->d_subdirs, d_u.d_child) { |
207 | if (bus->d_inode) { | 207 | if (bus->d_inode) { |
@@ -219,7 +219,7 @@ static void update_sb(struct super_block *sb) | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | up(&root->d_inode->i_sem); | 222 | mutex_unlock(&root->d_inode->i_mutex); |
223 | } | 223 | } |
224 | 224 | ||
225 | static int remount(struct super_block *sb, int *flags, char *data) | 225 | static int remount(struct super_block *sb, int *flags, char *data) |
@@ -333,10 +333,10 @@ static int usbfs_empty (struct dentry *dentry) | |||
333 | static int usbfs_unlink (struct inode *dir, struct dentry *dentry) | 333 | static int usbfs_unlink (struct inode *dir, struct dentry *dentry) |
334 | { | 334 | { |
335 | struct inode *inode = dentry->d_inode; | 335 | struct inode *inode = dentry->d_inode; |
336 | down(&inode->i_sem); | 336 | mutex_lock(&inode->i_mutex); |
337 | dentry->d_inode->i_nlink--; | 337 | dentry->d_inode->i_nlink--; |
338 | dput(dentry); | 338 | dput(dentry); |
339 | up(&inode->i_sem); | 339 | mutex_unlock(&inode->i_mutex); |
340 | d_delete(dentry); | 340 | d_delete(dentry); |
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
@@ -346,7 +346,7 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
346 | int error = -ENOTEMPTY; | 346 | int error = -ENOTEMPTY; |
347 | struct inode * inode = dentry->d_inode; | 347 | struct inode * inode = dentry->d_inode; |
348 | 348 | ||
349 | down(&inode->i_sem); | 349 | mutex_lock(&inode->i_mutex); |
350 | dentry_unhash(dentry); | 350 | dentry_unhash(dentry); |
351 | if (usbfs_empty(dentry)) { | 351 | if (usbfs_empty(dentry)) { |
352 | dentry->d_inode->i_nlink -= 2; | 352 | dentry->d_inode->i_nlink -= 2; |
@@ -355,7 +355,7 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
355 | dir->i_nlink--; | 355 | dir->i_nlink--; |
356 | error = 0; | 356 | error = 0; |
357 | } | 357 | } |
358 | up(&inode->i_sem); | 358 | mutex_unlock(&inode->i_mutex); |
359 | if (!error) | 359 | if (!error) |
360 | d_delete(dentry); | 360 | d_delete(dentry); |
361 | dput(dentry); | 361 | dput(dentry); |
@@ -380,7 +380,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) | |||
380 | { | 380 | { |
381 | loff_t retval = -EINVAL; | 381 | loff_t retval = -EINVAL; |
382 | 382 | ||
383 | down(&file->f_dentry->d_inode->i_sem); | 383 | mutex_lock(&file->f_dentry->d_inode->i_mutex); |
384 | switch(orig) { | 384 | switch(orig) { |
385 | case 0: | 385 | case 0: |
386 | if (offset > 0) { | 386 | if (offset > 0) { |
@@ -397,7 +397,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) | |||
397 | default: | 397 | default: |
398 | break; | 398 | break; |
399 | } | 399 | } |
400 | up(&file->f_dentry->d_inode->i_sem); | 400 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); |
401 | return retval; | 401 | return retval; |
402 | } | 402 | } |
403 | 403 | ||
@@ -480,7 +480,7 @@ static int fs_create_by_name (const char *name, mode_t mode, | |||
480 | } | 480 | } |
481 | 481 | ||
482 | *dentry = NULL; | 482 | *dentry = NULL; |
483 | down(&parent->d_inode->i_sem); | 483 | mutex_lock(&parent->d_inode->i_mutex); |
484 | *dentry = lookup_one_len(name, parent, strlen(name)); | 484 | *dentry = lookup_one_len(name, parent, strlen(name)); |
485 | if (!IS_ERR(dentry)) { | 485 | if (!IS_ERR(dentry)) { |
486 | if ((mode & S_IFMT) == S_IFDIR) | 486 | if ((mode & S_IFMT) == S_IFDIR) |
@@ -489,7 +489,7 @@ static int fs_create_by_name (const char *name, mode_t mode, | |||
489 | error = usbfs_create (parent->d_inode, *dentry, mode); | 489 | error = usbfs_create (parent->d_inode, *dentry, mode); |
490 | } else | 490 | } else |
491 | error = PTR_ERR(dentry); | 491 | error = PTR_ERR(dentry); |
492 | up(&parent->d_inode->i_sem); | 492 | mutex_unlock(&parent->d_inode->i_mutex); |
493 | 493 | ||
494 | return error; | 494 | return error; |
495 | } | 495 | } |
@@ -528,7 +528,7 @@ static void fs_remove_file (struct dentry *dentry) | |||
528 | if (!parent || !parent->d_inode) | 528 | if (!parent || !parent->d_inode) |
529 | return; | 529 | return; |
530 | 530 | ||
531 | down(&parent->d_inode->i_sem); | 531 | mutex_lock(&parent->d_inode->i_mutex); |
532 | if (usbfs_positive(dentry)) { | 532 | if (usbfs_positive(dentry)) { |
533 | if (dentry->d_inode) { | 533 | if (dentry->d_inode) { |
534 | if (S_ISDIR(dentry->d_inode->i_mode)) | 534 | if (S_ISDIR(dentry->d_inode->i_mode)) |
@@ -538,7 +538,7 @@ static void fs_remove_file (struct dentry *dentry) | |||
538 | dput(dentry); | 538 | dput(dentry); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | up(&parent->d_inode->i_sem); | 541 | mutex_unlock(&parent->d_inode->i_mutex); |
542 | } | 542 | } |
543 | 543 | ||
544 | /* --------------------------------------------------------------------- */ | 544 | /* --------------------------------------------------------------------- */ |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 0cea9782d7d4..de59c58896d6 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -1891,7 +1891,7 @@ static int fsync_sub(struct lun *curlun) | |||
1891 | return -EINVAL; | 1891 | return -EINVAL; |
1892 | 1892 | ||
1893 | inode = filp->f_dentry->d_inode; | 1893 | inode = filp->f_dentry->d_inode; |
1894 | down(&inode->i_sem); | 1894 | mutex_lock(&inode->i_mutex); |
1895 | current->flags |= PF_SYNCWRITE; | 1895 | current->flags |= PF_SYNCWRITE; |
1896 | rc = filemap_fdatawrite(inode->i_mapping); | 1896 | rc = filemap_fdatawrite(inode->i_mapping); |
1897 | err = filp->f_op->fsync(filp, filp->f_dentry, 1); | 1897 | err = filp->f_op->fsync(filp, filp->f_dentry, 1); |
@@ -1901,7 +1901,7 @@ static int fsync_sub(struct lun *curlun) | |||
1901 | if (!rc) | 1901 | if (!rc) |
1902 | rc = err; | 1902 | rc = err; |
1903 | current->flags &= ~PF_SYNCWRITE; | 1903 | current->flags &= ~PF_SYNCWRITE; |
1904 | up(&inode->i_sem); | 1904 | mutex_unlock(&inode->i_mutex); |
1905 | VLDBG(curlun, "fdatasync -> %d\n", rc); | 1905 | VLDBG(curlun, "fdatasync -> %d\n", rc); |
1906 | return rc; | 1906 | return rc; |
1907 | } | 1907 | } |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 5c40980a5bd9..c6c279de832e 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1562,10 +1562,10 @@ restart: | |||
1562 | spin_unlock_irq (&dev->lock); | 1562 | spin_unlock_irq (&dev->lock); |
1563 | 1563 | ||
1564 | /* break link to dcache */ | 1564 | /* break link to dcache */ |
1565 | down (&parent->i_sem); | 1565 | mutex_lock (&parent->i_mutex); |
1566 | d_delete (dentry); | 1566 | d_delete (dentry); |
1567 | dput (dentry); | 1567 | dput (dentry); |
1568 | up (&parent->i_sem); | 1568 | mutex_unlock (&parent->i_mutex); |
1569 | 1569 | ||
1570 | /* fds may still be open */ | 1570 | /* fds may still be open */ |
1571 | goto restart; | 1571 | goto restart; |