[PATCH 1/1] drivers/net/wireless/brcm80211/brcmsmac/dma.c: replace shift loop by ilog2

From: Fabian Frederick
Date: Tue May 20 2014 - 12:35:47 EST


Don't open code ilog2 -> remove dma_align_sizetobits

Cc: Brett Rudley <brudley@xxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
drivers/net/wireless/brcm80211/brcmsmac/dma.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index 4fb9635..7128c78 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -451,15 +451,6 @@ static void *dma_alloc_consistent(struct dma_info *di, uint size,
return dma_alloc_coherent(di->dmadev, size, pap, GFP_ATOMIC);
}

-static
-u8 dma_align_sizetobits(uint size)
-{
- u8 bitpos = 0;
- while (size >>= 1)
- bitpos++;
- return bitpos;
-}
-
/* This function ensures that the DMA descriptor ring will not get allocated
* across Page boundary. If the allocation is done across the page boundary
* at the first time, then it is freed and the allocation is done at
@@ -482,7 +473,7 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
desc_strtaddr = (u32) roundup((unsigned long)va, alignbytes);
if (((desc_strtaddr + size - 1) & boundary) != (desc_strtaddr
& boundary)) {
- *alignbits = dma_align_sizetobits(size);
+ *alignbits = ilog2(size);
dma_free_coherent(di->dmadev, size, va, *descpa);
va = dma_alloc_consistent(di, size, *alignbits,
alloced, descpa);
--
1.8.4.5

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