MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR);
MODULE_ALIAS_SCSI_DEVICE(TYPE_MEDIUM_CHANGER);
-static DEFINE_MUTEX(ch_mutex);
static int init = 1;
module_param(init, int, 0444);
MODULE_PARM_DESC(init, \
scsi_changer *ch;
int minor = iminor(inode);
- mutex_lock(&ch_mutex);
spin_lock(&ch_index_lock);
ch = idr_find(&ch_index_idr, minor);
if (ch == NULL || !kref_get_unless_zero(&ch->ref)) {
spin_unlock(&ch_index_lock);
- mutex_unlock(&ch_mutex);
return -ENXIO;
}
spin_unlock(&ch_index_lock);
if (scsi_device_get(ch->device)) {
kref_put(&ch->ref, ch_destroy);
- mutex_unlock(&ch_mutex);
return -ENXIO;
}
/* Synchronize with ch_probe() */
mutex_lock(&ch->lock);
file->private_data = ch;
mutex_unlock(&ch->lock);
- mutex_unlock(&ch_mutex);
return 0;
}