mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 12:52:30 +00:00
staging: rts5208: Remove macros scsi_lock(), scsi_unlock()
The scsi_lock() and scsi_unlock() macros protect the sm_state and the single queue element srb for write access in the driver. As suggested, these names are very generic. Remove the macros from header file and call spin_lock_irq() & spin_unlock_irq() directly instead. Suggested-by: Dan Carpenter <dan.carpenter@linaro.org> Suggested-by: Julia Lawall <julia.lawall@inria.fr> Signed-off-by: Soumya Negi <soumya.negi97@gmail.com> Link: https://lore.kernel.org/r/75a5990190cf7a5d20d1c27237b90b583e68ced8.1697152251.git.soumya.negi97@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5b91f876f9
commit
84b52696b9
@ -117,7 +117,7 @@ static int slave_configure(struct scsi_device *sdev)
|
||||
} while (0)
|
||||
|
||||
/* queue a command */
|
||||
/* This is always called with scsi_lock(host) held */
|
||||
/* This is always called with spin_lock_irq(host->host_lock) held */
|
||||
static int queuecommand_lck(struct scsi_cmnd *srb)
|
||||
{
|
||||
void (*done)(struct scsi_cmnd *) = scsi_done;
|
||||
@ -159,18 +159,18 @@ static int command_abort(struct scsi_cmnd *srb)
|
||||
struct rtsx_dev *dev = host_to_rtsx(host);
|
||||
struct rtsx_chip *chip = dev->chip;
|
||||
|
||||
scsi_lock(host);
|
||||
spin_lock_irq(host->host_lock);
|
||||
|
||||
/* Is this command still active? */
|
||||
if (chip->srb != srb) {
|
||||
scsi_unlock(host);
|
||||
spin_unlock_irq(host->host_lock);
|
||||
dev_info(&dev->pci->dev, "-- nothing to abort\n");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
rtsx_set_stat(chip, RTSX_STAT_ABORT);
|
||||
|
||||
scsi_unlock(host);
|
||||
spin_unlock_irq(host->host_lock);
|
||||
|
||||
/* Wait for the aborted command to finish */
|
||||
wait_for_completion(&dev->notify);
|
||||
@ -366,7 +366,7 @@ static int rtsx_control_thread(void *__dev)
|
||||
}
|
||||
|
||||
/* lock access to the state */
|
||||
scsi_lock(host);
|
||||
spin_lock_irq(host->host_lock);
|
||||
|
||||
/* has the command aborted ? */
|
||||
if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) {
|
||||
@ -374,7 +374,7 @@ static int rtsx_control_thread(void *__dev)
|
||||
goto skip_for_abort;
|
||||
}
|
||||
|
||||
scsi_unlock(host);
|
||||
spin_unlock_irq(host->host_lock);
|
||||
|
||||
/* reject the command if the direction indicator
|
||||
* is UNKNOWN
|
||||
@ -402,7 +402,7 @@ static int rtsx_control_thread(void *__dev)
|
||||
}
|
||||
|
||||
/* lock access to the state */
|
||||
scsi_lock(host);
|
||||
spin_lock_irq(host->host_lock);
|
||||
|
||||
/* did the command already complete because of a disconnect? */
|
||||
if (!chip->srb)
|
||||
@ -424,7 +424,7 @@ skip_for_abort:
|
||||
|
||||
/* finished working on this command */
|
||||
chip->srb = NULL;
|
||||
scsi_unlock(host);
|
||||
spin_unlock_irq(host->host_lock);
|
||||
|
||||
/* unlock the device pointers */
|
||||
mutex_unlock(&dev->dev_mutex);
|
||||
@ -603,9 +603,9 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
|
||||
* interrupt a SCSI-scan or device-reset delay
|
||||
*/
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
scsi_lock(host);
|
||||
spin_lock_irq(host->host_lock);
|
||||
rtsx_set_stat(chip, RTSX_STAT_DISCONNECT);
|
||||
scsi_unlock(host);
|
||||
spin_unlock_irq(host->host_lock);
|
||||
mutex_unlock(&dev->dev_mutex);
|
||||
wake_up(&dev->delay_wait);
|
||||
wait_for_completion(&dev->scanning_done);
|
||||
@ -621,10 +621,10 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
|
||||
mutex_lock(&dev->dev_mutex);
|
||||
if (chip->srb) {
|
||||
chip->srb->result = DID_NO_CONNECT << 16;
|
||||
scsi_lock(host);
|
||||
spin_lock_irq(host->host_lock);
|
||||
scsi_done(dev->chip->srb);
|
||||
chip->srb = NULL;
|
||||
scsi_unlock(host);
|
||||
spin_unlock_irq(host->host_lock);
|
||||
}
|
||||
mutex_unlock(&dev->dev_mutex);
|
||||
|
||||
|
@ -108,13 +108,6 @@ static inline struct rtsx_dev *host_to_rtsx(struct Scsi_Host *host)
|
||||
return (struct rtsx_dev *)host->hostdata;
|
||||
}
|
||||
|
||||
/*
|
||||
* The scsi_lock() and scsi_unlock() macros protect the sm_state and the
|
||||
* single queue element srb for write access
|
||||
*/
|
||||
#define scsi_unlock(host) spin_unlock_irq(host->host_lock)
|
||||
#define scsi_lock(host) spin_lock_irq(host->host_lock)
|
||||
|
||||
#define lock_state(chip) spin_lock_irq(&((chip)->rtsx->reg_lock))
|
||||
#define unlock_state(chip) spin_unlock_irq(&((chip)->rtsx->reg_lock))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user