Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hannes Reinecke and committed by
Martin K. Petersen
30f6d494 1c7ce4bc

-5
-5
drivers/scsi/ch.c
··· 44 44 MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR); 45 45 MODULE_ALIAS_SCSI_DEVICE(TYPE_MEDIUM_CHANGER); 46 46 47 - static DEFINE_MUTEX(ch_mutex); 48 47 static int init = 1; 49 48 module_param(init, int, 0444); 50 49 MODULE_PARM_DESC(init, \ ··· 590 591 scsi_changer *ch; 591 592 int minor = iminor(inode); 592 593 593 - mutex_lock(&ch_mutex); 594 594 spin_lock(&ch_index_lock); 595 595 ch = idr_find(&ch_index_idr, minor); 596 596 597 597 if (ch == NULL || !kref_get_unless_zero(&ch->ref)) { 598 598 spin_unlock(&ch_index_lock); 599 - mutex_unlock(&ch_mutex); 600 599 return -ENXIO; 601 600 } 602 601 spin_unlock(&ch_index_lock); 603 602 if (scsi_device_get(ch->device)) { 604 603 kref_put(&ch->ref, ch_destroy); 605 - mutex_unlock(&ch_mutex); 606 604 return -ENXIO; 607 605 } 608 606 /* Synchronize with ch_probe() */ 609 607 mutex_lock(&ch->lock); 610 608 file->private_data = ch; 611 609 mutex_unlock(&ch->lock); 612 - mutex_unlock(&ch_mutex); 613 610 return 0; 614 611 } 615 612