Commit ef29888ea8e1fdc499e995260195b66fc91d2728
Committed by
Bartlomiej Zolnierkiewicz
1 parent
c283f5dbe3
Exists in
master
and in
4 other branches
ide: use mutex instead of ide_cfg_sem semaphore in IDE driver
The IDE driver uses a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Showing 3 changed files with 9 additions and 9 deletions Side-by-side Diff
drivers/ide/ide-probe.c
... | ... | @@ -1025,7 +1025,7 @@ |
1025 | 1025 | BUG_ON(irqs_disabled()); |
1026 | 1026 | BUG_ON(hwif == NULL); |
1027 | 1027 | |
1028 | - down(&ide_cfg_sem); | |
1028 | + mutex_lock(&ide_cfg_mtx); | |
1029 | 1029 | hwif->hwgroup = NULL; |
1030 | 1030 | #if MAX_HWIFS > 1 |
1031 | 1031 | /* |
... | ... | @@ -1154,7 +1154,7 @@ |
1154 | 1154 | printk(" (%sed with %s)", |
1155 | 1155 | hwif->sharing_irq ? "shar" : "serializ", match->name); |
1156 | 1156 | printk("\n"); |
1157 | - up(&ide_cfg_sem); | |
1157 | + mutex_unlock(&ide_cfg_mtx); | |
1158 | 1158 | return 0; |
1159 | 1159 | out_unlink: |
1160 | 1160 | spin_lock_irq(&ide_lock); |
... | ... | @@ -1177,7 +1177,7 @@ |
1177 | 1177 | } |
1178 | 1178 | spin_unlock_irq(&ide_lock); |
1179 | 1179 | out_up: |
1180 | - up(&ide_cfg_sem); | |
1180 | + mutex_unlock(&ide_cfg_mtx); | |
1181 | 1181 | return 1; |
1182 | 1182 | } |
1183 | 1183 |
drivers/ide/ide.c
... | ... | @@ -169,7 +169,7 @@ |
169 | 169 | static int idebus_parameter; /* holds the "idebus=" parameter */ |
170 | 170 | static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */ |
171 | 171 | |
172 | -DECLARE_MUTEX(ide_cfg_sem); | |
172 | +DEFINE_MUTEX(ide_cfg_mtx); | |
173 | 173 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock); |
174 | 174 | |
175 | 175 | #ifdef CONFIG_IDEPCI_PCIBUS_ORDER |
... | ... | @@ -564,7 +564,7 @@ |
564 | 564 | { |
565 | 565 | ide_drive_t *drive; |
566 | 566 | ide_hwif_t *hwif, *g; |
567 | - static ide_hwif_t tmp_hwif; /* protected by ide_cfg_sem */ | |
567 | + static ide_hwif_t tmp_hwif; /* protected by ide_cfg_mtx */ | |
568 | 568 | ide_hwgroup_t *hwgroup; |
569 | 569 | int irq_count = 0, unit; |
570 | 570 | |
... | ... | @@ -572,7 +572,7 @@ |
572 | 572 | |
573 | 573 | BUG_ON(in_interrupt()); |
574 | 574 | BUG_ON(irqs_disabled()); |
575 | - down(&ide_cfg_sem); | |
575 | + mutex_lock(&ide_cfg_mtx); | |
576 | 576 | spin_lock_irq(&ide_lock); |
577 | 577 | hwif = &ide_hwifs[index]; |
578 | 578 | if (!hwif->present) |
... | ... | @@ -679,7 +679,7 @@ |
679 | 679 | |
680 | 680 | abort: |
681 | 681 | spin_unlock_irq(&ide_lock); |
682 | - up(&ide_cfg_sem); | |
682 | + mutex_unlock(&ide_cfg_mtx); | |
683 | 683 | } |
684 | 684 | |
685 | 685 | EXPORT_SYMBOL(ide_unregister); |
include/linux/ide.h
... | ... | @@ -1382,11 +1382,11 @@ |
1382 | 1382 | |
1383 | 1383 | |
1384 | 1384 | extern spinlock_t ide_lock; |
1385 | -extern struct semaphore ide_cfg_sem; | |
1385 | +extern struct mutex ide_cfg_mtx; | |
1386 | 1386 | /* |
1387 | 1387 | * Structure locking: |
1388 | 1388 | * |
1389 | - * ide_cfg_sem and ide_lock together protect changes to | |
1389 | + * ide_cfg_mtx and ide_lock together protect changes to | |
1390 | 1390 | * ide_hwif_t->{next,hwgroup} |
1391 | 1391 | * ide_drive_t->next |
1392 | 1392 | * |