diff options
Diffstat (limited to 'drivers/scsi/ch.c')
-rw-r--r-- | drivers/scsi/ch.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index d6532187f616..e805c8fda239 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/chio.h> /* here are all the ioctls */ | 22 | #include <linux/chio.h> /* here are all the ioctls */ |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/idr.h> | 24 | #include <linux/idr.h> |
25 | #include <linux/smp_lock.h> | ||
26 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
27 | 26 | ||
28 | #include <scsi/scsi.h> | 27 | #include <scsi/scsi.h> |
@@ -44,6 +43,7 @@ MODULE_LICENSE("GPL"); | |||
44 | MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR); | 43 | MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR); |
45 | MODULE_ALIAS_SCSI_DEVICE(TYPE_MEDIUM_CHANGER); | 44 | MODULE_ALIAS_SCSI_DEVICE(TYPE_MEDIUM_CHANGER); |
46 | 45 | ||
46 | static DEFINE_MUTEX(ch_mutex); | ||
47 | static int init = 1; | 47 | static int init = 1; |
48 | module_param(init, int, 0444); | 48 | module_param(init, int, 0444); |
49 | MODULE_PARM_DESC(init, \ | 49 | MODULE_PARM_DESC(init, \ |
@@ -581,19 +581,19 @@ ch_open(struct inode *inode, struct file *file) | |||
581 | scsi_changer *ch; | 581 | scsi_changer *ch; |
582 | int minor = iminor(inode); | 582 | int minor = iminor(inode); |
583 | 583 | ||
584 | lock_kernel(); | 584 | mutex_lock(&ch_mutex); |
585 | spin_lock(&ch_index_lock); | 585 | spin_lock(&ch_index_lock); |
586 | ch = idr_find(&ch_index_idr, minor); | 586 | ch = idr_find(&ch_index_idr, minor); |
587 | 587 | ||
588 | if (NULL == ch || scsi_device_get(ch->device)) { | 588 | if (NULL == ch || scsi_device_get(ch->device)) { |
589 | spin_unlock(&ch_index_lock); | 589 | spin_unlock(&ch_index_lock); |
590 | unlock_kernel(); | 590 | mutex_unlock(&ch_mutex); |
591 | return -ENXIO; | 591 | return -ENXIO; |
592 | } | 592 | } |
593 | spin_unlock(&ch_index_lock); | 593 | spin_unlock(&ch_index_lock); |
594 | 594 | ||
595 | file->private_data = ch; | 595 | file->private_data = ch; |
596 | unlock_kernel(); | 596 | mutex_unlock(&ch_mutex); |
597 | return 0; | 597 | return 0; |
598 | } | 598 | } |
599 | 599 | ||