summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorhba
diff options
context:
space:
mode:
authorSteven Matthews <steven.matthews@unisys.com>2017-08-22 13:27:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-22 14:56:03 -0700
commit55515a30d2e583908145817df2fdf31fa04b4401 (patch)
tree339df03186b25a50fd8e7c167dfe73ba97303987 /drivers/staging/unisys/visorhba
parent12cbd490435ceef86828f66011ece4187a2cbb7d (diff)
downloadlinux-55515a30d2e583908145817df2fdf31fa04b4401.tar.bz2
staging: unisys: include: fix improper use of dma_data_direction
Replace use of standard Linux dma_data_direction with a Unisys- specific uis_dma_data_direction and provide a function to convert from the latter to the former. This is necessary because Unisys s-Par depends on the exact format of this field in multiple OSs and languages, and so using the standard version creates an unnecessary dependency between the kernel and s-Par. Signed-off-by: Steven Matthews <steven.matthews@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Reviewed-by: Tim Sell <timothy.sell@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/unisys/visorhba')
-rw-r--r--drivers/staging/unisys/visorhba/visorhba_main.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 2a4248ac7d1e..29efdf9ed7ec 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -478,6 +478,29 @@ static const char *visorhba_get_info(struct Scsi_Host *shp)
}
/*
+ * dma_data_dir_linux_to_spar - convert dma_data_direction value to
+ * Unisys-specific equivalent
+ * @d: dma direction value to convert
+ *
+ * Returns the Unisys-specific dma direction value corresponding to @d
+ */
+static u32 dma_data_dir_linux_to_spar(enum dma_data_direction d)
+{
+ switch (d) {
+ case DMA_BIDIRECTIONAL:
+ return UIS_DMA_BIDIRECTIONAL;
+ case DMA_TO_DEVICE:
+ return UIS_DMA_TO_DEVICE;
+ case DMA_FROM_DEVICE:
+ return UIS_DMA_FROM_DEVICE;
+ case DMA_NONE:
+ return UIS_DMA_NONE;
+ default:
+ return UIS_DMA_NONE;
+ }
+}
+
+/*
* visorhba_queue_command_lck - Queues command to the Service Partition
* @scsicmd: Command to be queued
* @vsiorhba_cmnd_done: Done command to call when scsicmd is returned
@@ -525,7 +548,8 @@ static int visorhba_queue_command_lck(struct scsi_cmnd *scsicmd,
cmdrsp->scsi.vdest.id = scsidev->id;
cmdrsp->scsi.vdest.lun = scsidev->lun;
/* save datadir */
- cmdrsp->scsi.data_dir = scsicmd->sc_data_direction;
+ cmdrsp->scsi.data_dir =
+ dma_data_dir_linux_to_spar(scsicmd->sc_data_direction);
memcpy(cmdrsp->scsi.cmnd, cdb, MAX_CMND_SIZE);
cmdrsp->scsi.bufflen = scsi_bufflen(scsicmd);