Skip to content

Commit 30f6d49

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: ch: remove ch_mutex()
ch_mutex() was introduced with a mechanical conversion, but as we now have correct locking we can remove it altogether. Link: https://lore.kernel.org/r/20200213153207.123357-4-hare@suse.de Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 1c7ce4b commit 30f6d49

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

‎drivers/scsi/ch.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ MODULE_LICENSE("GPL");
4444
MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR);
4545
MODULE_ALIAS_SCSI_DEVICE(TYPE_MEDIUM_CHANGER);
4646

47-
static DEFINE_MUTEX(ch_mutex);
4847
static int init = 1;
4948
module_param(init, int, 0444);
5049
MODULE_PARM_DESC(init, \
@@ -591,26 +590,22 @@ ch_open(struct inode *inode, struct file *file)
591590
scsi_changer *ch;
592591
int minor = iminor(inode);
593592

594-
mutex_lock(&ch_mutex);
595593
spin_lock(&ch_index_lock);
596594
ch = idr_find(&ch_index_idr, minor);
597595

598596
if (ch == NULL || !kref_get_unless_zero(&ch->ref)) {
599597
spin_unlock(&ch_index_lock);
600-
mutex_unlock(&ch_mutex);
601598
return -ENXIO;
602599
}
603600
spin_unlock(&ch_index_lock);
604601
if (scsi_device_get(ch->device)) {
605602
kref_put(&ch->ref, ch_destroy);
606-
mutex_unlock(&ch_mutex);
607603
return -ENXIO;
608604
}
609605
/* Synchronize with ch_probe() */
610606
mutex_lock(&ch->lock);
611607
file->private_data = ch;
612608
mutex_unlock(&ch->lock);
613-
mutex_unlock(&ch_mutex);
614609
return 0;
615610
}
616611

0 commit comments

Comments
 (0)