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

scsi: qla1280: 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-42-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
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>

authored by

Bart Van Assche and committed by
Martin K. Petersen
504540d0 4a938517

+5 -19
+4 -17
drivers/scsi/qla1280.c
··· 477 477 #endif 478 478 479 479 480 - /* 481 - * We use the scsi_pointer structure that's included with each scsi_command 482 - * to overlay our struct srb over it. qla1280_init() checks that a srb is not 483 - * bigger than a scsi_pointer. 484 - */ 485 - 486 - #define CMD_SP(Cmnd) &Cmnd->SCp 487 480 #define CMD_CDBLEN(Cmnd) Cmnd->cmd_len 488 481 #define CMD_CDBP(Cmnd) Cmnd->cmnd 489 482 #define CMD_SNSP(Cmnd) Cmnd->sense_buffer ··· 686 693 { 687 694 struct Scsi_Host *host = cmd->device->host; 688 695 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; 689 - struct srb *sp = (struct srb *)CMD_SP(cmd); 696 + struct srb *sp = scsi_cmd_priv(cmd); 690 697 int status; 691 698 692 699 sp->cmd = cmd; ··· 821 828 ENTER("qla1280_error_action"); 822 829 823 830 ha = (struct scsi_qla_host *)(CMD_HOST(cmd)->hostdata); 824 - sp = (struct srb *)CMD_SP(cmd); 831 + sp = scsi_cmd_priv(cmd); 825 832 bus = SCSI_BUS_32(cmd); 826 833 target = SCSI_TCN_32(cmd); 827 834 lun = SCSI_LUN_32(cmd); ··· 3952 3959 int i; 3953 3960 ha = (struct scsi_qla_host *)host->hostdata; 3954 3961 3955 - sp = (struct srb *)CMD_SP(cmd); 3962 + sp = scsi_cmd_priv(cmd); 3956 3963 printk("SCSI Command @= 0x%p, Handle=0x%p\n", cmd, CMD_HANDLE(cmd)); 3957 3964 printk(" chan=%d, target = 0x%02x, lun = 0x%02x, cmd_len = 0x%02x\n", 3958 3965 SCSI_BUS_32(cmd), SCSI_TCN_32(cmd), SCSI_LUN_32(cmd), ··· 3972 3979 } */ 3973 3980 printk(" tag=%d, transfersize=0x%x \n", 3974 3981 scsi_cmd_to_rq(cmd)->tag, cmd->transfersize); 3975 - printk(" SP=0x%p\n", CMD_SP(cmd)); 3976 3982 printk(" underflow size = 0x%x, direction=0x%x\n", 3977 3983 cmd->underflow, cmd->sc_data_direction); 3978 3984 } ··· 4131 4139 .can_queue = MAX_OUTSTANDING_COMMANDS, 4132 4140 .this_id = -1, 4133 4141 .sg_tablesize = SG_ALL, 4142 + .cmd_size = sizeof(struct srb), 4134 4143 }; 4135 4144 4136 4145 ··· 4344 4351 static int __init 4345 4352 qla1280_init(void) 4346 4353 { 4347 - if (sizeof(struct srb) > sizeof(struct scsi_pointer)) { 4348 - printk(KERN_WARNING 4349 - "qla1280: struct srb too big, aborting\n"); 4350 - return -EINVAL; 4351 - } 4352 - 4353 4354 #ifdef MODULE 4354 4355 /* 4355 4356 * If we are called as a module, the qla1280 pointer may not be null
+1 -2
drivers/scsi/qla1280.h
··· 87 87 #define RESPONSE_ENTRY_CNT 63 /* Number of response entries. */ 88 88 89 89 /* 90 - * SCSI Request Block structure (sp) that is placed 91 - * on cmd->SCp location of every I/O 90 + * SCSI Request Block structure (sp) that occurs after each struct scsi_cmnd. 92 91 */ 93 92 struct srb { 94 93 struct list_head list; /* (8/16) LU queue */