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

scsi: mac53c94: 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/3529a59873a7de8455a27af2528341afe5069adc.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
55a94551 2e1b3175

+15 -16
+10 -11
drivers/scsi/mac53c94.c
··· 194 194 struct mac53c94_regs __iomem *regs = state->regs; 195 195 struct dbdma_regs __iomem *dma = state->dma; 196 196 struct scsi_cmnd *const cmd = state->current_req; 197 - struct scsi_pointer *const scsi_pointer = mac53c94_scsi_pointer(cmd); 197 + struct mac53c94_cmd_priv *const mcmd = mac53c94_priv(cmd); 198 198 int nb, stat, seq, intr; 199 199 static int mac53c94_errors; 200 200 ··· 264 264 /* set DMA controller going if any data to transfer */ 265 265 if ((stat & (STAT_MSG|STAT_CD)) == 0 266 266 && (scsi_sg_count(cmd) > 0 || scsi_bufflen(cmd))) { 267 - nb = scsi_pointer->this_residual; 267 + nb = mcmd->this_residual; 268 268 if (nb > 0xfff0) 269 269 nb = 0xfff0; 270 - scsi_pointer->this_residual -= nb; 270 + mcmd->this_residual -= nb; 271 271 writeb(nb, &regs->count_lo); 272 272 writeb(nb >> 8, &regs->count_mid); 273 273 writeb(CMD_DMA_MODE + CMD_NOP, &regs->command); ··· 294 294 cmd_done(state, DID_ERROR << 16); 295 295 return; 296 296 } 297 - if (scsi_pointer->this_residual != 0 297 + if (mcmd->this_residual != 0 298 298 && (stat & (STAT_MSG|STAT_CD)) == 0) { 299 299 /* Set up the count regs to transfer more */ 300 - nb = scsi_pointer->this_residual; 300 + nb = mcmd->this_residual; 301 301 if (nb > 0xfff0) 302 302 nb = 0xfff0; 303 - scsi_pointer->this_residual -= nb; 303 + mcmd->this_residual -= nb; 304 304 writeb(nb, &regs->count_lo); 305 305 writeb(nb >> 8, &regs->count_mid); 306 306 writeb(CMD_DMA_MODE + CMD_NOP, &regs->command); ··· 322 322 cmd_done(state, DID_ERROR << 16); 323 323 return; 324 324 } 325 - scsi_pointer->Status = readb(&regs->fifo); 326 - scsi_pointer->Message = readb(&regs->fifo); 325 + mcmd->status = readb(&regs->fifo); 326 + mcmd->message = readb(&regs->fifo); 327 327 writeb(CMD_ACCEPT_MSG, &regs->command); 328 328 state->phase = busfreeing; 329 329 break; ··· 331 331 if (intr != INTR_DISCONNECT) { 332 332 printk(KERN_DEBUG "got intr %x when expected disconnect\n", intr); 333 333 } 334 - cmd_done(state, (DID_OK << 16) + (scsi_pointer->Message << 8) 335 - + scsi_pointer->Status); 334 + cmd_done(state, (DID_OK << 16) + (mcmd->message << 8) + mcmd->status); 336 335 break; 337 336 default: 338 337 printk(KERN_DEBUG "don't know about phase %d\n", state->phase); ··· 389 390 dma_cmd += OUTPUT_LAST - OUTPUT_MORE; 390 391 dcmds[-1].command = cpu_to_le16(dma_cmd); 391 392 dcmds->command = cpu_to_le16(DBDMA_STOP); 392 - mac53c94_scsi_pointer(cmd)->this_residual = total; 393 + mac53c94_priv(cmd)->this_residual = total; 393 394 } 394 395 395 396 static struct scsi_host_template mac53c94_template = {
+5 -5
drivers/scsi/mac53c94.h
··· 213 213 #define CF4_BBTE 0x01 214 214 215 215 struct mac53c94_cmd_priv { 216 - struct scsi_pointer scsi_pointer; 216 + int this_residual; 217 + int status; 218 + int message; 217 219 }; 218 220 219 - static inline struct scsi_pointer *mac53c94_scsi_pointer(struct scsi_cmnd *cmd) 221 + static inline struct mac53c94_cmd_priv *mac53c94_priv(struct scsi_cmnd *cmd) 220 222 { 221 - struct mac53c94_cmd_priv *mcmd = scsi_cmd_priv(cmd); 222 - 223 - return &mcmd->scsi_pointer; 223 + return scsi_cmd_priv(cmd); 224 224 } 225 225 226 226 #endif /* _MAC53C94_H */