On Wed, Dec 13, 2006 at 10:10:05PM -0500, Ben Collins wrote:
> At least on PPC, the "op ? op : dma" construct causes a compile failure
> because the dma_* is a do{}while(0) macro.
> 
> This turns all of them into proper if/else to avoid this problem.

NAK.

Proper fix is to kill stupid do { } while (0) mess.  It's supposed
to behave like a function returning void, so it should be ((void)0).

Signed-off-by: Al Viro <[EMAIL PROTECTED]>
---

diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h
index 57e09f5..ce759ea 100644
--- a/include/asm-alpha/dma-mapping.h
+++ b/include/asm-alpha/dma-mapping.h
@@ -41,9 +41,9 @@ #define dma_supported(dev, mask)              (mask 
 #define dma_map_single(dev, va, size, dir)     virt_to_phys(va)
 #define dma_map_page(dev, page, off, size, dir)        (page_to_pa(page) + off)
 
-#define dma_unmap_single(dev, addr, size, dir) do { } while (0)
-#define dma_unmap_page(dev, addr, size, dir)   do { } while (0)
-#define dma_unmap_sg(dev, sg, nents, dir)      do { } while (0)
+#define dma_unmap_single(dev, addr, size, dir) ((void)0)
+#define dma_unmap_page(dev, addr, size, dir)   ((void)0)
+#define dma_unmap_sg(dev, sg, nents, dir)      ((void)0)
 
 #define dma_mapping_error(addr)  (0)
 
@@ -55,12 +55,12 @@ #define dma_is_consistent(d, h)                     (1)
 
 int dma_set_mask(struct device *dev, u64 mask);
 
-#define dma_sync_single_for_cpu(dev, addr, size, dir)    do { } while (0)
-#define dma_sync_single_for_device(dev, addr, size, dir)  do { } while (0)
-#define dma_sync_single_range(dev, addr, off, size, dir)  do { } while (0)
-#define dma_sync_sg_for_cpu(dev, sg, nents, dir)         do { } while (0)
-#define dma_sync_sg_for_device(dev, sg, nents, dir)      do { } while (0)
-#define dma_cache_sync(dev, va, size, dir)               do { } while (0)
+#define dma_sync_single_for_cpu(dev, addr, size, dir)    ((void)0)
+#define dma_sync_single_for_device(dev, addr, size, dir)  ((void)0)
+#define dma_sync_single_range(dev, addr, off, size, dir)  ((void)0)
+#define dma_sync_sg_for_cpu(dev, sg, nents, dir)         ((void)0)
+#define dma_sync_sg_for_device(dev, sg, nents, dir)      ((void)0)
+#define dma_cache_sync(dev, va, size, dir)               ((void)0)
 
 #define dma_get_cache_alignment()                        L1_CACHE_BYTES
 
diff --git a/include/asm-powerpc/dma-mapping.h 
b/include/asm-powerpc/dma-mapping.h
index 7c7de87..a19a6f1 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -37,9 +37,9 @@ #else /* ! CONFIG_NOT_COHERENT_CACHE */
  */
 
 #define __dma_alloc_coherent(gfp, size, handle)        NULL
-#define __dma_free_coherent(size, addr)                do { } while (0)
-#define __dma_sync(addr, size, rw)             do { } while (0)
-#define __dma_sync_page(pg, off, sz, rw)       do { } while (0)
+#define __dma_free_coherent(size, addr)                ((void)0)
+#define __dma_sync(addr, size, rw)             ((void)0)
+#define __dma_sync_page(pg, off, sz, rw)       ((void)0)
 
 #endif /* ! CONFIG_NOT_COHERENT_CACHE */
 
@@ -251,7 +251,7 @@ dma_map_single(struct device *dev, void 
 }
 
 /* We do nothing. */
-#define dma_unmap_single(dev, addr, size, dir) do { } while (0)
+#define dma_unmap_single(dev, addr, size, dir) ((void)0)
 
 static inline dma_addr_t
 dma_map_page(struct device *dev, struct page *page,
@@ -266,7 +266,7 @@ dma_map_page(struct device *dev, struct 
 }
 
 /* We do nothing. */
-#define dma_unmap_page(dev, handle, size, dir) do { } while (0)
+#define dma_unmap_page(dev, handle, size, dir) ((void)0)
 
 static inline int
 dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
@@ -286,7 +286,7 @@ dma_map_sg(struct device *dev, struct sc
 }
 
 /* We don't do anything here. */
-#define dma_unmap_sg(dev, sg, nents, dir)      do { } while (0)
+#define dma_unmap_sg(dev, sg, nents, dir)      ((void)0)
 
 #endif /* CONFIG_PPC64 */
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to