diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 0101d0def7c5..ebc59064b475 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -443,6 +443,7 @@ | |||
443 | #include <linux/smp_lock.h> | 443 | #include <linux/smp_lock.h> |
444 | #include <linux/completion.h> | 444 | #include <linux/completion.h> |
445 | #include <linux/bitops.h> | 445 | #include <linux/bitops.h> |
446 | #include <linux/mutex.h> | ||
446 | 447 | ||
447 | #include <asm/byteorder.h> | 448 | #include <asm/byteorder.h> |
448 | #include <asm/irq.h> | 449 | #include <asm/irq.h> |
@@ -1011,7 +1012,7 @@ typedef struct ide_tape_obj { | |||
1011 | int debug_level; | 1012 | int debug_level; |
1012 | } idetape_tape_t; | 1013 | } idetape_tape_t; |
1013 | 1014 | ||
1014 | static DECLARE_MUTEX(idetape_ref_sem); | 1015 | static DEFINE_MUTEX(idetape_ref_mutex); |
1015 | 1016 | ||
1016 | static struct class *idetape_sysfs_class; | 1017 | static struct class *idetape_sysfs_class; |
1017 | 1018 | ||
@@ -1024,11 +1025,11 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) | |||
1024 | { | 1025 | { |
1025 | struct ide_tape_obj *tape = NULL; | 1026 | struct ide_tape_obj *tape = NULL; |
1026 | 1027 | ||
1027 | down(&idetape_ref_sem); | 1028 | mutex_lock(&idetape_ref_mutex); |
1028 | tape = ide_tape_g(disk); | 1029 | tape = ide_tape_g(disk); |
1029 | if (tape) | 1030 | if (tape) |
1030 | kref_get(&tape->kref); | 1031 | kref_get(&tape->kref); |
1031 | up(&idetape_ref_sem); | 1032 | mutex_unlock(&idetape_ref_mutex); |
1032 | return tape; | 1033 | return tape; |
1033 | } | 1034 | } |
1034 | 1035 | ||
@@ -1036,9 +1037,9 @@ static void ide_tape_release(struct kref *); | |||
1036 | 1037 | ||
1037 | static void ide_tape_put(struct ide_tape_obj *tape) | 1038 | static void ide_tape_put(struct ide_tape_obj *tape) |
1038 | { | 1039 | { |
1039 | down(&idetape_ref_sem); | 1040 | mutex_lock(&idetape_ref_mutex); |
1040 | kref_put(&tape->kref, ide_tape_release); | 1041 | kref_put(&tape->kref, ide_tape_release); |
1041 | up(&idetape_ref_sem); | 1042 | mutex_unlock(&idetape_ref_mutex); |
1042 | } | 1043 | } |
1043 | 1044 | ||
1044 | /* | 1045 | /* |
@@ -1290,11 +1291,11 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i) | |||
1290 | { | 1291 | { |
1291 | struct ide_tape_obj *tape = NULL; | 1292 | struct ide_tape_obj *tape = NULL; |
1292 | 1293 | ||
1293 | down(&idetape_ref_sem); | 1294 | mutex_lock(&idetape_ref_mutex); |
1294 | tape = idetape_devs[i]; | 1295 | tape = idetape_devs[i]; |
1295 | if (tape) | 1296 | if (tape) |
1296 | kref_get(&tape->kref); | 1297 | kref_get(&tape->kref); |
1297 | up(&idetape_ref_sem); | 1298 | mutex_unlock(&idetape_ref_mutex); |
1298 | return tape; | 1299 | return tape; |
1299 | } | 1300 | } |
1300 | 1301 | ||
@@ -4870,11 +4871,11 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
4870 | 4871 | ||
4871 | drive->driver_data = tape; | 4872 | drive->driver_data = tape; |
4872 | 4873 | ||
4873 | down(&idetape_ref_sem); | 4874 | mutex_lock(&idetape_ref_mutex); |
4874 | for (minor = 0; idetape_devs[minor]; minor++) | 4875 | for (minor = 0; idetape_devs[minor]; minor++) |
4875 | ; | 4876 | ; |
4876 | idetape_devs[minor] = tape; | 4877 | idetape_devs[minor] = tape; |
4877 | up(&idetape_ref_sem); | 4878 | mutex_unlock(&idetape_ref_mutex); |
4878 | 4879 | ||
4879 | idetape_setup(drive, tape, minor); | 4880 | idetape_setup(drive, tape, minor); |
4880 | 4881 | ||