Commit 40e5c96b authored by Brett Rudley's avatar Brett Rudley Committed by Greg Kroah-Hartman

staging: brcm80211: Coalesce osl_dma_alloc_consistent between fullmac and softmac

Combine dma_alloc routine for full and softmac
Signed-off-by: default avatarBrett Rudley <brudley@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 17b31385
...@@ -107,20 +107,19 @@ extern uint osl_malloced(osl_t *osh); ...@@ -107,20 +107,19 @@ extern uint osl_malloced(osl_t *osh);
#define NATIVE_MALLOC(osh, size) kmalloc(size, GFP_ATOMIC) #define NATIVE_MALLOC(osh, size) kmalloc(size, GFP_ATOMIC)
#define NATIVE_MFREE(osh, addr, size) kfree(addr) #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 #ifdef BRCM_FULLMAC
#define DMA_CONSISTENT_ALIGN PAGE_SIZE
#define DMA_ALLOC_CONSISTENT(osh, size, pap, dmah, alignbits) \ #define DMA_ALLOC_CONSISTENT(osh, size, pap, dmah, alignbits) \
osl_dma_alloc_consistent((osh), (size), (pap)) osl_dma_alloc_consistent((osh), (size), (0), (tot), (pap))
extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, unsigned long *pap);
#else #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) \ #define DMA_ALLOC_CONSISTENT(osh, size, align, tot, pap, dmah) \
osl_dma_alloc_consistent((osh), (size), (align), (tot), (pap)) osl_dma_alloc_consistent((osh), (size), (align), (tot), (pap))
extern uint osl_dma_consistent_align(void); #endif /* BRCM_FULLMAC */
extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, u16 align,
uint *tot, unsigned long *pap);
#endif
#define DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \ #define DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \
osl_dma_free_consistent((osh), (void *)(va), (size), (pa)) 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); extern void osl_dma_free_consistent(osl_t *osh, void *va, uint size, unsigned long pa);
......
...@@ -505,27 +505,19 @@ uint osl_dma_consistent_align(void) ...@@ -505,27 +505,19 @@ uint osl_dma_consistent_align(void)
return PAGE_SIZE; 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, void *osl_dma_alloc_consistent(osl_t *osh, uint size, u16 align_bits,
uint *alloced, unsigned long *pap) uint *alloced, unsigned long *pap)
{ {
u16 align = (1 << align_bits);
ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
if (align_bits) {
u16 align = (1 << align_bits);
if (!IS_ALIGNED(DMA_CONSISTENT_ALIGN, align)) if (!IS_ALIGNED(DMA_CONSISTENT_ALIGN, align))
size += align; size += align;
*alloced = size; *alloced = size;
}
return pci_alloc_consistent(osh->pdev, size, (dma_addr_t *) pap); 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) void osl_dma_free_consistent(osl_t *osh, void *va, uint size, unsigned long pa)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment