]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: advansys: Move the SCSI pointer to private command data
authorBart Van Assche <bvanassche@acm.org>
Fri, 18 Feb 2022 19:50:41 +0000 (11:50 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Feb 2022 02:11:03 +0000 (21:11 -0500)
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-14-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/advansys.c

index ace5eff828e96acba509994790974531cb87e2f1..f301aec044bbfa4d9093ba1ff15697b347775836 100644 (file)
@@ -2277,6 +2277,15 @@ struct asc_board {
                                                        dvc_var.adv_dvc_var)
 #define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev)
 
+struct advansys_cmd {
+       dma_addr_t dma_handle;
+};
+
+static struct advansys_cmd *advansys_cmd(struct scsi_cmnd *cmd)
+{
+       return scsi_cmd_priv(cmd);
+}
+
 #ifdef ADVANSYS_DEBUG
 static int asc_dbglvl = 3;
 
@@ -6681,7 +6690,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
 
        ASC_STATS(boardp->shost, callback);
 
-       dma_unmap_single(boardp->dev, scp->SCp.dma_handle,
+       dma_unmap_single(boardp->dev, advansys_cmd(scp)->dma_handle,
                         SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
        /*
         * 'qdonep' contains the command's ending status.
@@ -7399,15 +7408,15 @@ static int advansys_slave_configure(struct scsi_device *sdev)
 static __le32 asc_get_sense_buffer_dma(struct scsi_cmnd *scp)
 {
        struct asc_board *board = shost_priv(scp->device->host);
+       struct advansys_cmd *acmd = advansys_cmd(scp);
 
-       scp->SCp.dma_handle = dma_map_single(board->dev, scp->sense_buffer,
-                                            SCSI_SENSE_BUFFERSIZE,
-                                            DMA_FROM_DEVICE);
-       if (dma_mapping_error(board->dev, scp->SCp.dma_handle)) {
+       acmd->dma_handle = dma_map_single(board->dev, scp->sense_buffer,
+                                       SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
+       if (dma_mapping_error(board->dev, acmd->dma_handle)) {
                ASC_DBG(1, "failed to map sense buffer\n");
                return 0;
        }
-       return cpu_to_le32(scp->SCp.dma_handle);
+       return cpu_to_le32(acmd->dma_handle);
 }
 
 static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
@@ -10604,6 +10613,7 @@ static struct scsi_host_template advansys_template = {
        .eh_host_reset_handler = advansys_reset,
        .bios_param = advansys_biosparam,
        .slave_configure = advansys_slave_configure,
+       .cmd_size = sizeof(struct advansys_cmd),
 };
 
 static int advansys_wide_init_chip(struct Scsi_Host *shost)