staging: brcm80211: Coalesce osl_dma_alloc_consistent between fullmac and softmac
authorBrett Rudley <brudley@broadcom.com>
Fri, 8 Oct 2010 20:57:13 +0000 (13:57 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Oct 2010 21:32:52 +0000 (14:32 -0700)
Combine dma_alloc routine for full and softmac

Signed-off-by: Brett Rudley <brudley@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/include/linux_osl.h
drivers/staging/brcm80211/util/linux_osl.c

index ea1de98b59ac0c440a5d068aef97033937953670..a8ccc74cc4b42d7c1e08be78dbbc972322b5f5bd 100644 (file)
@@ -107,20 +107,19 @@ extern uint osl_malloced(osl_t *osh);
 #define NATIVE_MALLOC(osh, size)       kmalloc(size, GFP_ATOMIC)
 #define NATIVE_MFREE(osh, addr, size)  kfree(addr)
 
+#define        DMA_CONSISTENT_ALIGN    osl_dma_consistent_align()
+extern uint osl_dma_consistent_align(void);
+extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, u16 align,
+                                     uint *tot, unsigned long *pap);
+
 #ifdef BRCM_FULLMAC
-#define        DMA_CONSISTENT_ALIGN    PAGE_SIZE
 #define        DMA_ALLOC_CONSISTENT(osh, size, pap, dmah, alignbits) \
-       osl_dma_alloc_consistent((osh), (size), (pap))
-extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, unsigned long *pap);
+       osl_dma_alloc_consistent((osh), (size), (0), (tot), (pap))
 #else
-/* allocate/free shared (dma-able) consistent memory */
-#define        DMA_CONSISTENT_ALIGN    osl_dma_consistent_align()
 #define        DMA_ALLOC_CONSISTENT(osh, size, align, tot, pap, dmah) \
        osl_dma_alloc_consistent((osh), (size), (align), (tot), (pap))
-extern uint osl_dma_consistent_align(void);
-extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, u16 align,
-                                     uint *tot, unsigned long *pap);
-#endif
+#endif /* BRCM_FULLMAC */
+
 #define        DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \
        osl_dma_free_consistent((osh), (void *)(va), (size), (pa))
 extern void osl_dma_free_consistent(osl_t *osh, void *va, uint size, unsigned long pa);
index 096f8095219601d49c29c940f2d8815f8dc5e7e7..391f33caafdef5167742155d58afc95864318ae7 100644 (file)
@@ -505,27 +505,19 @@ uint osl_dma_consistent_align(void)
        return PAGE_SIZE;
 }
 
-#ifdef BRCM_FULLMAC
-void *osl_dma_alloc_consistent(osl_t *osh, uint size, unsigned long *pap)
-{
-       ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
-
-       return pci_alloc_consistent(osh->pdev, size, (dma_addr_t *) pap);
-}
-#else /* !BRCM_FULLMAC */
 void *osl_dma_alloc_consistent(osl_t *osh, uint size, u16 align_bits,
                               uint *alloced, unsigned long *pap)
 {
-       u16 align = (1 << align_bits);
        ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
 
-       if (!IS_ALIGNED(DMA_CONSISTENT_ALIGN, align))
-               size += align;
-       *alloced = size;
-
+       if (align_bits) {
+               u16 align = (1 << align_bits);
+               if (!IS_ALIGNED(DMA_CONSISTENT_ALIGN, align))
+                       size += align;
+               *alloced = size;
+       }
        return pci_alloc_consistent(osh->pdev, size, (dma_addr_t *) pap);
 }
-#endif /* BRCM_FULLMAC */
 
 void osl_dma_free_consistent(osl_t *osh, void *va, uint size, unsigned long pa)
 {