[PATCH 01/10] staging: unisys: include: fix improper use of dma_data_direction
David Kershner
david.kershner at unisys.com
Wed Feb 1 22:38:53 UTC 2017
From: Steven Matthews <steven.matthews at unisys.com>
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 at unisys.com>
Signed-off-by: David Kershner <david.kershner at unisys.com>
---
drivers/staging/unisys/include/iochannel.h | 11 +++++++--
drivers/staging/unisys/visorhba/visorhba_main.c | 22 +++++++++++++++++-
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h
index 54f4900..6e80462 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -31,7 +31,6 @@
#include <linux/uuid.h>
-#include <linux/dma-direction.h>
#include "channel.h"
#define ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
@@ -80,6 +79,14 @@
/* Size of cdb - i.e., SCSI cmnd */
#define MAX_CMND_SIZE 16
+/* Unisys-specific DMA direction values */
+enum uis_dma_data_direction {
+ UIS_DMA_BIDIRECTIONAL = 0,
+ UIS_DMA_TO_DEVICE,
+ UIS_DMA_FROM_DEVICE,
+ UIS_DMA_NONE
+};
+
#define MAX_SENSE_SIZE 64
#define MAX_PHYS_INFO 64
@@ -192,7 +199,7 @@ struct uiscmdrsp_scsi {
* information for each
* fragment
*/
- enum dma_data_direction data_dir; /* direction of the data, if any */
+ enum uis_dma_data_direction data_dir; /* direction of the data */
struct uisscsi_dest vdest; /* identifies the virtual hba, id, */
/* channel, lun to which cmd was sent */
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 0ce92c8..8765f67 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -462,6 +462,25 @@ static const char *visorhba_get_info(struct Scsi_Host *shp)
return "visorhba";
}
+/*
+ * 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 enum
+uis_dma_data_direction 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
@@ -512,7 +531,8 @@ 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);
--
git-series 0.9.1
More information about the devel
mailing list