diff mbox series

[3/3] ch: remove ch_mutex()

Message ID 20200213153207.123357-4-hare@suse.de (mailing list archive)
State Accepted
Headers show
Series ch: fixup refcounting imbalance for SCSI devices | expand

Commit Message

Hannes Reinecke Feb. 13, 2020, 3:32 p.m. UTC
ch_mutex() was introduced with a mechanical conversion, but as we
now have correct locking we can remove it altogether.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/ch.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Bart Van Assche Feb. 20, 2020, 4:51 a.m. UTC | #1
On 2020-02-13 07:32, Hannes Reinecke wrote:
> ch_mutex() was introduced with a mechanical conversion, but as we
> now have correct locking we can remove it altogether.
 Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff mbox series

Patch

diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 9cbfb00ab950..4ea3b61f275f 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -44,7 +44,6 @@  MODULE_LICENSE("GPL");
 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, \
@@ -591,26 +590,22 @@  ch_open(struct inode *inode, struct file *file)
 	scsi_changer *ch;
 	int minor = iminor(inode);
 
-	mutex_lock(&ch_mutex);
 	spin_lock(&ch_index_lock);
 	ch = idr_find(&ch_index_idr, minor);
 
 	if (NULL == ch || !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;
 }