Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Finn Thain and committed by
Martin K. Petersen
2e1b3175 5c139ce9

+14 -15
+9 -10
drivers/scsi/mesh.c
··· 586 586 ms->current_req = NULL; 587 587 tp->current_req = NULL; 588 588 if (cmd) { 589 - struct scsi_pointer *scsi_pointer = mesh_scsi_pointer(cmd); 589 + struct mesh_cmd_priv *mcmd = mesh_priv(cmd); 590 590 591 591 set_host_byte(cmd, ms->stat); 592 - set_status_byte(cmd, scsi_pointer->Status); 592 + set_status_byte(cmd, mcmd->status); 593 593 if (ms->stat == DID_OK) 594 - scsi_msg_to_host_byte(cmd, scsi_pointer->Message); 594 + scsi_msg_to_host_byte(cmd, mcmd->message); 595 595 if (DEBUG_TARGET(cmd)) { 596 596 printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n", 597 597 cmd->result, ms->data_ptr, scsi_bufflen(cmd)); ··· 605 605 } 606 606 #endif 607 607 } 608 - scsi_pointer->this_residual -= ms->data_ptr; 608 + mcmd->this_residual -= ms->data_ptr; 609 609 scsi_done(cmd); 610 610 } 611 611 if (start_next) { ··· 1173 1173 if (ms->n_msgin < msgin_length(ms)) 1174 1174 goto reject; 1175 1175 if (cmd) 1176 - mesh_scsi_pointer(cmd)->Message = code; 1176 + mesh_priv(cmd)->message = code; 1177 1177 switch (code) { 1178 1178 case COMMAND_COMPLETE: 1179 1179 break; ··· 1264 1264 if (cmd) { 1265 1265 int nseg; 1266 1266 1267 - mesh_scsi_pointer(cmd)->this_residual = scsi_bufflen(cmd); 1267 + mesh_priv(cmd)->this_residual = scsi_bufflen(cmd); 1268 1268 1269 1269 nseg = scsi_dma_map(cmd); 1270 1270 BUG_ON(nseg < 0); ··· 1594 1594 break; 1595 1595 case statusing: 1596 1596 if (cmd) { 1597 - struct scsi_pointer *scsi_pointer = 1598 - mesh_scsi_pointer(cmd); 1597 + struct mesh_cmd_priv *mcmd = mesh_priv(cmd); 1599 1598 1600 - scsi_pointer->Status = mr->fifo; 1599 + mcmd->status = mr->fifo; 1601 1600 if (DEBUG_TARGET(cmd)) 1602 1601 printk(KERN_DEBUG "mesh: status is %x\n", 1603 - scsi_pointer->Status); 1602 + mcmd->status); 1604 1603 } 1605 1604 ms->msgphase = msg_in; 1606 1605 break;
+5 -5
drivers/scsi/mesh.h
··· 9 9 #define _MESH_H 10 10 11 11 struct mesh_cmd_priv { 12 - struct scsi_pointer scsi_pointer; 12 + int this_residual; 13 + int message; 14 + int status; 13 15 }; 14 16 15 - static inline struct scsi_pointer *mesh_scsi_pointer(struct scsi_cmnd *cmd) 17 + static inline struct mesh_cmd_priv *mesh_priv(struct scsi_cmnd *cmd) 16 18 { 17 - struct mesh_cmd_priv *mcmd = scsi_cmd_priv(cmd); 18 - 19 - return &mcmd->scsi_pointer; 19 + return scsi_cmd_priv(cmd); 20 20 } 21 21 22 22 /*