summaryrefslogtreecommitdiff
path: root/drivers/staging/rts5208
diff options
context:
space:
mode:
authorSoumya Negi <soumya.negi97@gmail.com>2023-10-12 16:29:06 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-15 18:20:35 +0200
commit84b52696b99edbc63a855b5a44d9e7f02e11fde5 (patch)
tree365aa2671e073f9602f271c8258b5de500439bfb /drivers/staging/rts5208
parent5b91f876f9e31c106177ee9341412d64e51f5ebf (diff)
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>
Diffstat (limited to 'drivers/staging/rts5208')
-rw-r--r--drivers/staging/rts5208/rtsx.c24
-rw-r--r--drivers/staging/rts5208/rtsx.h7
2 files changed, 12 insertions, 19 deletions
diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 08543a3936da..86d32e3b3282 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -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);
diff --git a/drivers/staging/rts5208/rtsx.h b/drivers/staging/rts5208/rtsx.h
index ea29646b8c38..ec6f5b07390b 100644
--- a/drivers/staging/rts5208/rtsx.h
+++ b/drivers/staging/rts5208/rtsx.h
@@ -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))