[PATCH] scsi_to_dma_dir

Marc Zyngier (mzyngier@freesurf.fr)
25 Apr 2003 11:48:00 +0200


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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/