[PATCH 01/10] staging: unisys: include: fix improper use of dma_data_direction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Steven Matthews <steven.matthews@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx>
---
 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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux