summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-02-18 20:51:02 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2022-02-23 03:11:06 +0100
commit57cbd78e61cf15269f4149669b51b94028263dc1 (patch)
tree3dee57ffc1c60d41f736e343bc3ccf19dc6941df /drivers/scsi
parentscsi: megasas: Stop using the SCSI pointer (diff)
downloadlinux-57cbd78e61cf15269f4149669b51b94028263dc1.tar.xz
linux-57cbd78e61cf15269f4149669b51b94028263dc1.zip
scsi: mesh: Move the SCSI pointer to private command data
Set .cmd_size in the SCSI host template instead of using the SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer from struct scsi_cmnd. Link: https://lore.kernel.org/r/20220218195117.25689-35-bvanassche@acm.org Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to '')
-rw-r--r--drivers/scsi/mesh.c20
-rw-r--r--drivers/scsi/mesh.h11
2 files changed, 24 insertions, 7 deletions
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index ca133e0a140a..de9ae36def42 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -586,10 +586,12 @@ static void mesh_done(struct mesh_state *ms, int start_next)
ms->current_req = NULL;
tp->current_req = NULL;
if (cmd) {
+ struct scsi_pointer *scsi_pointer = mesh_scsi_pointer(cmd);
+
set_host_byte(cmd, ms->stat);
- set_status_byte(cmd, cmd->SCp.Status);
+ set_status_byte(cmd, scsi_pointer->Status);
if (ms->stat == DID_OK)
- scsi_msg_to_host_byte(cmd, cmd->SCp.Message);
+ scsi_msg_to_host_byte(cmd, scsi_pointer->Message);
if (DEBUG_TARGET(cmd)) {
printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n",
cmd->result, ms->data_ptr, scsi_bufflen(cmd));
@@ -603,7 +605,7 @@ static void mesh_done(struct mesh_state *ms, int start_next)
}
#endif
}
- cmd->SCp.this_residual -= ms->data_ptr;
+ scsi_pointer->this_residual -= ms->data_ptr;
scsi_done(cmd);
}
if (start_next) {
@@ -1171,7 +1173,7 @@ static void handle_msgin(struct mesh_state *ms)
if (ms->n_msgin < msgin_length(ms))
goto reject;
if (cmd)
- cmd->SCp.Message = code;
+ mesh_scsi_pointer(cmd)->Message = code;
switch (code) {
case COMMAND_COMPLETE:
break;
@@ -1262,7 +1264,7 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)
if (cmd) {
int nseg;
- cmd->SCp.this_residual = scsi_bufflen(cmd);
+ mesh_scsi_pointer(cmd)->this_residual = scsi_bufflen(cmd);
nseg = scsi_dma_map(cmd);
BUG_ON(nseg < 0);
@@ -1592,10 +1594,13 @@ static void cmd_complete(struct mesh_state *ms)
break;
case statusing:
if (cmd) {
- cmd->SCp.Status = mr->fifo;
+ struct scsi_pointer *scsi_pointer =
+ mesh_scsi_pointer(cmd);
+
+ scsi_pointer->Status = mr->fifo;
if (DEBUG_TARGET(cmd))
printk(KERN_DEBUG "mesh: status is %x\n",
- cmd->SCp.Status);
+ scsi_pointer->Status);
}
ms->msgphase = msg_in;
break;
@@ -1837,6 +1842,7 @@ static struct scsi_host_template mesh_template = {
.sg_tablesize = SG_ALL,
.cmd_per_lun = 2,
.max_segment_size = 65535,
+ .cmd_size = sizeof(struct mesh_cmd_priv),
};
static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
diff --git a/drivers/scsi/mesh.h b/drivers/scsi/mesh.h
index ee53c05ace95..1afa8b37295b 100644
--- a/drivers/scsi/mesh.h
+++ b/drivers/scsi/mesh.h
@@ -8,6 +8,17 @@
#ifndef _MESH_H
#define _MESH_H
+struct mesh_cmd_priv {
+ struct scsi_pointer scsi_pointer;
+};
+
+static inline struct scsi_pointer *mesh_scsi_pointer(struct scsi_cmnd *cmd)
+{
+ struct mesh_cmd_priv *mcmd = scsi_cmd_priv(cmd);
+
+ return &mcmd->scsi_pointer;
+}
+
/*
* Registers in the MESH controller.
*/