mirror of
https://github.com/torvalds/linux.git
synced 2024-09-26 18:03:17 +00:00
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>
This commit is contained in:
parent
c283f5dbe3
commit
ef29888ea8
|
@ -1025,7 +1025,7 @@ static int init_irq (ide_hwif_t *hwif)
|
||||||
BUG_ON(irqs_disabled());
|
BUG_ON(irqs_disabled());
|
||||||
BUG_ON(hwif == NULL);
|
BUG_ON(hwif == NULL);
|
||||||
|
|
||||||
down(&ide_cfg_sem);
|
mutex_lock(&ide_cfg_mtx);
|
||||||
hwif->hwgroup = NULL;
|
hwif->hwgroup = NULL;
|
||||||
#if MAX_HWIFS > 1
|
#if MAX_HWIFS > 1
|
||||||
/*
|
/*
|
||||||
|
@ -1154,7 +1154,7 @@ static int init_irq (ide_hwif_t *hwif)
|
||||||
printk(" (%sed with %s)",
|
printk(" (%sed with %s)",
|
||||||
hwif->sharing_irq ? "shar" : "serializ", match->name);
|
hwif->sharing_irq ? "shar" : "serializ", match->name);
|
||||||
printk("\n");
|
printk("\n");
|
||||||
up(&ide_cfg_sem);
|
mutex_unlock(&ide_cfg_mtx);
|
||||||
return 0;
|
return 0;
|
||||||
out_unlink:
|
out_unlink:
|
||||||
spin_lock_irq(&ide_lock);
|
spin_lock_irq(&ide_lock);
|
||||||
|
@ -1177,7 +1177,7 @@ out_unlink:
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&ide_lock);
|
spin_unlock_irq(&ide_lock);
|
||||||
out_up:
|
out_up:
|
||||||
up(&ide_cfg_sem);
|
mutex_unlock(&ide_cfg_mtx);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR,
|
||||||
static int idebus_parameter; /* holds the "idebus=" parameter */
|
static int idebus_parameter; /* holds the "idebus=" parameter */
|
||||||
static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */
|
static int system_bus_speed; /* holds what we think is VESA/PCI bus speed */
|
||||||
|
|
||||||
DECLARE_MUTEX(ide_cfg_sem);
|
DEFINE_MUTEX(ide_cfg_mtx);
|
||||||
__cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
|
__cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
|
||||||
|
|
||||||
#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
|
#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
|
||||||
|
@ -564,7 +564,7 @@ void ide_unregister(unsigned int index)
|
||||||
{
|
{
|
||||||
ide_drive_t *drive;
|
ide_drive_t *drive;
|
||||||
ide_hwif_t *hwif, *g;
|
ide_hwif_t *hwif, *g;
|
||||||
static ide_hwif_t tmp_hwif; /* protected by ide_cfg_sem */
|
static ide_hwif_t tmp_hwif; /* protected by ide_cfg_mtx */
|
||||||
ide_hwgroup_t *hwgroup;
|
ide_hwgroup_t *hwgroup;
|
||||||
int irq_count = 0, unit;
|
int irq_count = 0, unit;
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ void ide_unregister(unsigned int index)
|
||||||
|
|
||||||
BUG_ON(in_interrupt());
|
BUG_ON(in_interrupt());
|
||||||
BUG_ON(irqs_disabled());
|
BUG_ON(irqs_disabled());
|
||||||
down(&ide_cfg_sem);
|
mutex_lock(&ide_cfg_mtx);
|
||||||
spin_lock_irq(&ide_lock);
|
spin_lock_irq(&ide_lock);
|
||||||
hwif = &ide_hwifs[index];
|
hwif = &ide_hwifs[index];
|
||||||
if (!hwif->present)
|
if (!hwif->present)
|
||||||
|
@ -679,7 +679,7 @@ void ide_unregister(unsigned int index)
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
spin_unlock_irq(&ide_lock);
|
spin_unlock_irq(&ide_lock);
|
||||||
up(&ide_cfg_sem);
|
mutex_unlock(&ide_cfg_mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(ide_unregister);
|
EXPORT_SYMBOL(ide_unregister);
|
||||||
|
|
|
@ -1382,11 +1382,11 @@ extern const ide_pio_timings_t ide_pio_timings[6];
|
||||||
|
|
||||||
|
|
||||||
extern spinlock_t ide_lock;
|
extern spinlock_t ide_lock;
|
||||||
extern struct semaphore ide_cfg_sem;
|
extern struct mutex ide_cfg_mtx;
|
||||||
/*
|
/*
|
||||||
* Structure locking:
|
* Structure locking:
|
||||||
*
|
*
|
||||||
* ide_cfg_sem and ide_lock together protect changes to
|
* ide_cfg_mtx and ide_lock together protect changes to
|
||||||
* ide_hwif_t->{next,hwgroup}
|
* ide_hwif_t->{next,hwgroup}
|
||||||
* ide_drive_t->next
|
* ide_drive_t->next
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user