diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:29 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:29 -0500 |
commit | 1f473e9c92ea458e60494561a2065a358b7239bb (patch) | |
tree | dc80484535ac987d49179c45f30f1fabadc8855a /drivers/ide/ide-proc.c | |
parent | 3e0e29f7373ec96a1bd972790649524af7353f42 (diff) |
ide: IDE settings don't need an ide_lock held
IDE settings are protected by ide_setting_mtx mutex so there is
no need to hold ide_lock in ide_setting_ioctl(), ide_read_setting()
and ide_proc_unregister_driver().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-proc.c')
-rw-r--r-- | drivers/ide/ide-proc.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index f3cddd1b2f8f..dd899e1f3841 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -155,13 +155,8 @@ static int ide_read_setting(ide_drive_t *drive, | |||
155 | const struct ide_devset *ds = setting->setting; | 155 | const struct ide_devset *ds = setting->setting; |
156 | int val = -EINVAL; | 156 | int val = -EINVAL; |
157 | 157 | ||
158 | if (ds->get) { | 158 | if (ds->get) |
159 | unsigned long flags; | ||
160 | |||
161 | spin_lock_irqsave(&ide_lock, flags); | ||
162 | val = ds->get(drive); | 159 | val = ds->get(drive); |
163 | spin_unlock_irqrestore(&ide_lock, flags); | ||
164 | } | ||
165 | 160 | ||
166 | return val; | 161 | return val; |
167 | } | 162 | } |
@@ -583,31 +578,19 @@ EXPORT_SYMBOL(ide_proc_register_driver); | |||
583 | * Clean up the driver specific /proc files and IDE settings | 578 | * Clean up the driver specific /proc files and IDE settings |
584 | * for a given drive. | 579 | * for a given drive. |
585 | * | 580 | * |
586 | * Takes ide_setting_mtx and ide_lock. | 581 | * Takes ide_setting_mtx. |
587 | * Caller must hold none of the locks. | ||
588 | */ | 582 | */ |
589 | 583 | ||
590 | void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) | 584 | void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) |
591 | { | 585 | { |
592 | unsigned long flags; | ||
593 | |||
594 | ide_remove_proc_entries(drive->proc, driver->proc_entries(drive)); | 586 | ide_remove_proc_entries(drive->proc, driver->proc_entries(drive)); |
595 | 587 | ||
596 | mutex_lock(&ide_setting_mtx); | 588 | mutex_lock(&ide_setting_mtx); |
597 | spin_lock_irqsave(&ide_lock, flags); | ||
598 | /* | 589 | /* |
599 | * ide_setting_mtx protects the settings list | 590 | * ide_setting_mtx protects both the settings list and the use |
600 | * ide_lock protects the use of settings | 591 | * of settings (we cannot take a setting out that is being used). |
601 | * | ||
602 | * so we need to hold both, ide_settings_sem because we want to | ||
603 | * modify the settings list, and ide_lock because we cannot take | ||
604 | * a setting out that is being used. | ||
605 | * | ||
606 | * OTOH both ide_{read,write}_setting are only ever used under | ||
607 | * ide_setting_mtx. | ||
608 | */ | 592 | */ |
609 | drive->settings = NULL; | 593 | drive->settings = NULL; |
610 | spin_unlock_irqrestore(&ide_lock, flags); | ||
611 | mutex_unlock(&ide_setting_mtx); | 594 | mutex_unlock(&ide_setting_mtx); |
612 | } | 595 | } |
613 | EXPORT_SYMBOL(ide_proc_unregister_driver); | 596 | EXPORT_SYMBOL(ide_proc_unregister_driver); |