linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi_to_dma_dir
@ 2003-04-25  9:48 Marc Zyngier
  0 siblings, 0 replies; only message in thread
From: Marc Zyngier @ 2003-04-25  9:48 UTC (permalink / raw)
  To: James Bottomley; +Cc: Christoph Hellwig, linux-kernel

James,

Christoph suggested that I send you the following patch, rather than
having it in the aha1740 driver... It adds scsi_to_dma_dir, similar to
scsi_to_{sbus,pci}_dir.

It is conditionnaly defined on CONFIG_EISA or CONFIG_MCA, because most
non-PCI archs are still including asm-generic/dma-mapping.h and its
bunch of PCI functions...

Patch is against 2.5.68.

Thanks,

        M.

===== drivers/scsi/scsi.h 1.73 vs edited =====
--- 1.73/drivers/scsi/scsi.h	Fri Apr 18 17:58:55 2003
+++ edited/drivers/scsi/scsi.h	Thu Apr 24 18:40:31 2003
@@ -67,6 +67,32 @@
 #endif
 #endif
 
+#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
+/*
+ * XXX FIXME :
+ *  
+ * We should be able to have this unconditionnaly
+ * defined. Unfortunately, most non-PCI architectures are still
+ * including asm-generic/dma-mapping.h, which has lots of references
+ * to PCI functions...
+ */
+#include <linux/dma-mapping.h>
+#if ((SCSI_DATA_UNKNOWN == DMA_BIDIRECTIONAL) && (SCSI_DATA_WRITE == DMA_TO_DEVICE) && (SCSI_DATA_READ == DMA_FROM_DEVICE) && (SCSI_DATA_NONE == DMA_NONE))
+#define scsi_to_dma_dir(scsi_dir)   ((enum dma_data_direction)(scsi_dir))
+#else
+extern __inline__ enum dma_data_direction scsi_to_dma_dir(unsigned char scsi_dir)
+{
+        if (scsi_dir == SCSI_DATA_UNKNOWN)
+                return DMA_BIDIRECTIONAL;
+        if (scsi_dir == SCSI_DATA_WRITE)
+                return DMA_TO_DEVICE;
+        if (scsi_dir == SCSI_DATA_READ)
+                return DMA_FROM_DEVICE;
+        return DMA_NONE;
+}
+#endif
+#endif
+
 /*
  * Some defs, in case these are not defined elsewhere.
  */

-- 
Places change, faces change. Life is so very strange.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-04-25  9:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-25  9:48 [PATCH] scsi_to_dma_dir Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).