mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
scsi: mesh: Stop using struct scsi_pointer
This driver doesn't use SCp.ptr to save a SCSI command data pointer which means "scsi pointer" is a complete misnomer here. Only a few members of struct scsi_pointer are used and the rest waste memory. Avoid the "struct foo { struct bar; };" silliness. Link: https://lore.kernel.org/r/fbf930e64af5b15ca028dfe25b00fe933951f19b.1645484982.git.fthain@linux-m68k.org Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Finn Thain <fthain@linux-m68k.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
5c139ce9e1
commit
2e1b3175f2
@ -586,12 +586,12 @@ static void mesh_done(struct mesh_state *ms, int start_next)
|
|||||||
ms->current_req = NULL;
|
ms->current_req = NULL;
|
||||||
tp->current_req = NULL;
|
tp->current_req = NULL;
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
struct scsi_pointer *scsi_pointer = mesh_scsi_pointer(cmd);
|
struct mesh_cmd_priv *mcmd = mesh_priv(cmd);
|
||||||
|
|
||||||
set_host_byte(cmd, ms->stat);
|
set_host_byte(cmd, ms->stat);
|
||||||
set_status_byte(cmd, scsi_pointer->Status);
|
set_status_byte(cmd, mcmd->status);
|
||||||
if (ms->stat == DID_OK)
|
if (ms->stat == DID_OK)
|
||||||
scsi_msg_to_host_byte(cmd, scsi_pointer->Message);
|
scsi_msg_to_host_byte(cmd, mcmd->message);
|
||||||
if (DEBUG_TARGET(cmd)) {
|
if (DEBUG_TARGET(cmd)) {
|
||||||
printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n",
|
printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n",
|
||||||
cmd->result, ms->data_ptr, scsi_bufflen(cmd));
|
cmd->result, ms->data_ptr, scsi_bufflen(cmd));
|
||||||
@ -605,7 +605,7 @@ static void mesh_done(struct mesh_state *ms, int start_next)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
scsi_pointer->this_residual -= ms->data_ptr;
|
mcmd->this_residual -= ms->data_ptr;
|
||||||
scsi_done(cmd);
|
scsi_done(cmd);
|
||||||
}
|
}
|
||||||
if (start_next) {
|
if (start_next) {
|
||||||
@ -1173,7 +1173,7 @@ static void handle_msgin(struct mesh_state *ms)
|
|||||||
if (ms->n_msgin < msgin_length(ms))
|
if (ms->n_msgin < msgin_length(ms))
|
||||||
goto reject;
|
goto reject;
|
||||||
if (cmd)
|
if (cmd)
|
||||||
mesh_scsi_pointer(cmd)->Message = code;
|
mesh_priv(cmd)->message = code;
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case COMMAND_COMPLETE:
|
case COMMAND_COMPLETE:
|
||||||
break;
|
break;
|
||||||
@ -1264,7 +1264,7 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd)
|
|||||||
if (cmd) {
|
if (cmd) {
|
||||||
int nseg;
|
int nseg;
|
||||||
|
|
||||||
mesh_scsi_pointer(cmd)->this_residual = scsi_bufflen(cmd);
|
mesh_priv(cmd)->this_residual = scsi_bufflen(cmd);
|
||||||
|
|
||||||
nseg = scsi_dma_map(cmd);
|
nseg = scsi_dma_map(cmd);
|
||||||
BUG_ON(nseg < 0);
|
BUG_ON(nseg < 0);
|
||||||
@ -1594,13 +1594,12 @@ static void cmd_complete(struct mesh_state *ms)
|
|||||||
break;
|
break;
|
||||||
case statusing:
|
case statusing:
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
struct scsi_pointer *scsi_pointer =
|
struct mesh_cmd_priv *mcmd = mesh_priv(cmd);
|
||||||
mesh_scsi_pointer(cmd);
|
|
||||||
|
|
||||||
scsi_pointer->Status = mr->fifo;
|
mcmd->status = mr->fifo;
|
||||||
if (DEBUG_TARGET(cmd))
|
if (DEBUG_TARGET(cmd))
|
||||||
printk(KERN_DEBUG "mesh: status is %x\n",
|
printk(KERN_DEBUG "mesh: status is %x\n",
|
||||||
scsi_pointer->Status);
|
mcmd->status);
|
||||||
}
|
}
|
||||||
ms->msgphase = msg_in;
|
ms->msgphase = msg_in;
|
||||||
break;
|
break;
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
#define _MESH_H
|
#define _MESH_H
|
||||||
|
|
||||||
struct mesh_cmd_priv {
|
struct mesh_cmd_priv {
|
||||||
struct scsi_pointer scsi_pointer;
|
int this_residual;
|
||||||
|
int message;
|
||||||
|
int status;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct scsi_pointer *mesh_scsi_pointer(struct scsi_cmnd *cmd)
|
static inline struct mesh_cmd_priv *mesh_priv(struct scsi_cmnd *cmd)
|
||||||
{
|
{
|
||||||
struct mesh_cmd_priv *mcmd = scsi_cmd_priv(cmd);
|
return scsi_cmd_priv(cmd);
|
||||||
|
|
||||||
return &mcmd->scsi_pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user