summaryrefslogtreecommitdiff
path: root/drivers/scsi/advansys.c
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-02-18 11:50:41 -0800
committerMartin K. Petersen <martin.petersen@oracle.com>2022-02-22 21:11:03 -0500
commit17d4c2e22aae046d85301e05c91b46b27d748afd (patch)
tree1e810aa8cf73c807414c3ad883e56a887e742a94 /drivers/scsi/advansys.c
parent76a3451b64c6d1718a651697670bd5dc557ed148 (diff)
downloadlwn-17d4c2e22aae046d85301e05c91b46b27d748afd.tar.gz
lwn-17d4c2e22aae046d85301e05c91b46b27d748afd.zip
scsi: advansys: 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-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>
Diffstat (limited to 'drivers/scsi/advansys.c')
-rw-r--r--drivers/scsi/advansys.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index ace5eff828e9..f301aec044bb 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -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)