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>
This commit is contained in:
parent
96e77a2743
commit
57cbd78e61
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue