Commit 17d4c2e2 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

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.orgReviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 76a3451b
...@@ -2277,6 +2277,15 @@ struct asc_board { ...@@ -2277,6 +2277,15 @@ struct asc_board {
dvc_var.adv_dvc_var) dvc_var.adv_dvc_var)
#define adv_dvc_to_pdev(adv_dvc) to_pci_dev(adv_dvc_to_board(adv_dvc)->dev) #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 #ifdef ADVANSYS_DEBUG
static int asc_dbglvl = 3; static int asc_dbglvl = 3;
...@@ -6681,7 +6690,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) ...@@ -6681,7 +6690,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
ASC_STATS(boardp->shost, callback); 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); SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
/* /*
* 'qdonep' contains the command's ending status. * 'qdonep' contains the command's ending status.
...@@ -7399,15 +7408,15 @@ static int advansys_slave_configure(struct scsi_device *sdev) ...@@ -7399,15 +7408,15 @@ static int advansys_slave_configure(struct scsi_device *sdev)
static __le32 asc_get_sense_buffer_dma(struct scsi_cmnd *scp) static __le32 asc_get_sense_buffer_dma(struct scsi_cmnd *scp)
{ {
struct asc_board *board = shost_priv(scp->device->host); 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, acmd->dma_handle = dma_map_single(board->dev, scp->sense_buffer,
SCSI_SENSE_BUFFERSIZE, SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
DMA_FROM_DEVICE); if (dma_mapping_error(board->dev, acmd->dma_handle)) {
if (dma_mapping_error(board->dev, scp->SCp.dma_handle)) {
ASC_DBG(1, "failed to map sense buffer\n"); ASC_DBG(1, "failed to map sense buffer\n");
return 0; 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, static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
...@@ -10604,6 +10613,7 @@ static struct scsi_host_template advansys_template = { ...@@ -10604,6 +10613,7 @@ static struct scsi_host_template advansys_template = {
.eh_host_reset_handler = advansys_reset, .eh_host_reset_handler = advansys_reset,
.bios_param = advansys_biosparam, .bios_param = advansys_biosparam,
.slave_configure = advansys_slave_configure, .slave_configure = advansys_slave_configure,
.cmd_size = sizeof(struct advansys_cmd),
}; };
static int advansys_wide_init_chip(struct Scsi_Host *shost) static int advansys_wide_init_chip(struct Scsi_Host *shost)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment