diff options
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r-- | drivers/ide/ide-disk.c | 11 |
1 files changed, 6 insertions, 5 deletions
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 | /* |