diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-cd.c | 11 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 11 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 11 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 19 |
4 files changed, 28 insertions, 24 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 430d8af35cb1..c7671e188017 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -313,6 +313,7 @@ | |||
313 | #include <linux/cdrom.h> | 313 | #include <linux/cdrom.h> |
314 | #include <linux/ide.h> | 314 | #include <linux/ide.h> |
315 | #include <linux/completion.h> | 315 | #include <linux/completion.h> |
316 | #include <linux/mutex.h> | ||
316 | 317 | ||
317 | #include <scsi/scsi.h> /* For SCSI -> ATAPI command conversion */ | 318 | #include <scsi/scsi.h> /* For SCSI -> ATAPI command conversion */ |
318 | 319 | ||
@@ -324,7 +325,7 @@ | |||
324 | 325 | ||
325 | #include "ide-cd.h" | 326 | #include "ide-cd.h" |
326 | 327 | ||
327 | static DECLARE_MUTEX(idecd_ref_sem); | 328 | static DEFINE_MUTEX(idecd_ref_mutex); |
328 | 329 | ||
329 | #define to_ide_cd(obj) container_of(obj, struct cdrom_info, kref) | 330 | #define to_ide_cd(obj) container_of(obj, struct cdrom_info, kref) |
330 | 331 | ||
@@ -335,11 +336,11 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk) | |||
335 | { | 336 | { |
336 | struct cdrom_info *cd = NULL; | 337 | struct cdrom_info *cd = NULL; |
337 | 338 | ||
338 | down(&idecd_ref_sem); | 339 | mutex_lock(&idecd_ref_mutex); |
339 | cd = ide_cd_g(disk); | 340 | cd = ide_cd_g(disk); |
340 | if (cd) | 341 | if (cd) |
341 | kref_get(&cd->kref); | 342 | kref_get(&cd->kref); |
342 | up(&idecd_ref_sem); | 343 | mutex_unlock(&idecd_ref_mutex); |
343 | return cd; | 344 | return cd; |
344 | } | 345 | } |
345 | 346 | ||
@@ -347,9 +348,9 @@ static void ide_cd_release(struct kref *); | |||
347 | 348 | ||
348 | static void ide_cd_put(struct cdrom_info *cd) | 349 | static void ide_cd_put(struct cdrom_info *cd) |
349 | { | 350 | { |
350 | down(&idecd_ref_sem); | 351 | mutex_lock(&idecd_ref_mutex); |
351 | kref_put(&cd->kref, ide_cd_release); | 352 | kref_put(&cd->kref, ide_cd_release); |
352 | up(&idecd_ref_sem); | 353 | mutex_unlock(&idecd_ref_mutex); |
353 | } | 354 | } |
354 | 355 | ||
355 | /**************************************************************************** | 356 | /**************************************************************************** |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 09086b8b6486..e238b7da824b 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/genhd.h> | 60 | #include <linux/genhd.h> |
61 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
62 | #include <linux/delay.h> | 62 | #include <linux/delay.h> |
63 | #include <linux/mutex.h> | ||
63 | 64 | ||
64 | #define _IDE_DISK | 65 | #define _IDE_DISK |
65 | 66 | ||
@@ -78,7 +79,7 @@ struct ide_disk_obj { | |||
78 | struct kref kref; | 79 | struct kref kref; |
79 | }; | 80 | }; |
80 | 81 | ||
81 | static DECLARE_MUTEX(idedisk_ref_sem); | 82 | static DEFINE_MUTEX(idedisk_ref_mutex); |
82 | 83 | ||
83 | #define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref) | 84 | #define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref) |
84 | 85 | ||
@@ -89,11 +90,11 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) | |||
89 | { | 90 | { |
90 | struct ide_disk_obj *idkp = NULL; | 91 | struct ide_disk_obj *idkp = NULL; |
91 | 92 | ||
92 | down(&idedisk_ref_sem); | 93 | mutex_lock(&idedisk_ref_mutex); |
93 | idkp = ide_disk_g(disk); | 94 | idkp = ide_disk_g(disk); |
94 | if (idkp) | 95 | if (idkp) |
95 | kref_get(&idkp->kref); | 96 | kref_get(&idkp->kref); |
96 | up(&idedisk_ref_sem); | 97 | mutex_unlock(&idedisk_ref_mutex); |
97 | return idkp; | 98 | return idkp; |
98 | } | 99 | } |
99 | 100 | ||
@@ -101,9 +102,9 @@ static void ide_disk_release(struct kref *); | |||
101 | 102 | ||
102 | static void ide_disk_put(struct ide_disk_obj *idkp) | 103 | static void ide_disk_put(struct ide_disk_obj *idkp) |
103 | { | 104 | { |
104 | down(&idedisk_ref_sem); | 105 | mutex_lock(&idedisk_ref_mutex); |
105 | kref_put(&idkp->kref, ide_disk_release); | 106 | kref_put(&idkp->kref, ide_disk_release); |
106 | up(&idedisk_ref_sem); | 107 | mutex_unlock(&idedisk_ref_mutex); |
107 | } | 108 | } |
108 | 109 | ||
109 | /* | 110 | /* |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 1f8db9ac05d1..a53e3ce4a142 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -98,6 +98,7 @@ | |||
98 | #include <linux/cdrom.h> | 98 | #include <linux/cdrom.h> |
99 | #include <linux/ide.h> | 99 | #include <linux/ide.h> |
100 | #include <linux/bitops.h> | 100 | #include <linux/bitops.h> |
101 | #include <linux/mutex.h> | ||
101 | 102 | ||
102 | #include <asm/byteorder.h> | 103 | #include <asm/byteorder.h> |
103 | #include <asm/irq.h> | 104 | #include <asm/irq.h> |
@@ -517,7 +518,7 @@ typedef struct { | |||
517 | u8 reserved[4]; | 518 | u8 reserved[4]; |
518 | } idefloppy_mode_parameter_header_t; | 519 | } idefloppy_mode_parameter_header_t; |
519 | 520 | ||
520 | static DECLARE_MUTEX(idefloppy_ref_sem); | 521 | static DEFINE_MUTEX(idefloppy_ref_mutex); |
521 | 522 | ||
522 | #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) | 523 | #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) |
523 | 524 | ||
@@ -528,11 +529,11 @@ static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) | |||
528 | { | 529 | { |
529 | struct ide_floppy_obj *floppy = NULL; | 530 | struct ide_floppy_obj *floppy = NULL; |
530 | 531 | ||
531 | down(&idefloppy_ref_sem); | 532 | mutex_lock(&idefloppy_ref_mutex); |
532 | floppy = ide_floppy_g(disk); | 533 | floppy = ide_floppy_g(disk); |
533 | if (floppy) | 534 | if (floppy) |
534 | kref_get(&floppy->kref); | 535 | kref_get(&floppy->kref); |
535 | up(&idefloppy_ref_sem); | 536 | mutex_unlock(&idefloppy_ref_mutex); |
536 | return floppy; | 537 | return floppy; |
537 | } | 538 | } |
538 | 539 | ||
@@ -540,9 +541,9 @@ static void ide_floppy_release(struct kref *); | |||
540 | 541 | ||
541 | static void ide_floppy_put(struct ide_floppy_obj *floppy) | 542 | static void ide_floppy_put(struct ide_floppy_obj *floppy) |
542 | { | 543 | { |
543 | down(&idefloppy_ref_sem); | 544 | mutex_lock(&idefloppy_ref_mutex); |
544 | kref_put(&floppy->kref, ide_floppy_release); | 545 | kref_put(&floppy->kref, ide_floppy_release); |
545 | up(&idefloppy_ref_sem); | 546 | mutex_unlock(&idefloppy_ref_mutex); |
546 | } | 547 | } |
547 | 548 | ||
548 | /* | 549 | /* |
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 | ||