b43legacy: replace the ssb_dma API with the generic DMA API

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stefano Brivio <stefano.brivio@polimi.it>
Cc: John W. Linville <linville@tuxdriver.com>
Acked-by: Michael Buesch <mb@bu3sch.de>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
FUJITA Tomonori 2010-06-03 19:37:33 -07:00 committed by John W. Linville
parent 14f92952bf
commit 4e8031328b

View File

@ -394,11 +394,11 @@ dma_addr_t map_descbuffer(struct b43legacy_dmaring *ring,
dma_addr_t dmaaddr; dma_addr_t dmaaddr;
if (tx) if (tx)
dmaaddr = ssb_dma_map_single(ring->dev->dev, dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
buf, len, buf, len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
else else
dmaaddr = ssb_dma_map_single(ring->dev->dev, dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
buf, len, buf, len,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
@ -412,11 +412,11 @@ void unmap_descbuffer(struct b43legacy_dmaring *ring,
int tx) int tx)
{ {
if (tx) if (tx)
ssb_dma_unmap_single(ring->dev->dev, dma_unmap_single(ring->dev->dev->dma_dev,
addr, len, addr, len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
else else
ssb_dma_unmap_single(ring->dev->dev, dma_unmap_single(ring->dev->dev->dma_dev,
addr, len, addr, len,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
} }
@ -428,8 +428,8 @@ void sync_descbuffer_for_cpu(struct b43legacy_dmaring *ring,
{ {
B43legacy_WARN_ON(ring->tx); B43legacy_WARN_ON(ring->tx);
ssb_dma_sync_single_for_cpu(ring->dev->dev, dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
addr, len, DMA_FROM_DEVICE); addr, len, DMA_FROM_DEVICE);
} }
static inline static inline
@ -439,8 +439,8 @@ void sync_descbuffer_for_device(struct b43legacy_dmaring *ring,
{ {
B43legacy_WARN_ON(ring->tx); B43legacy_WARN_ON(ring->tx);
ssb_dma_sync_single_for_device(ring->dev->dev, dma_sync_single_for_device(ring->dev->dev->dma_dev,
addr, len, DMA_FROM_DEVICE); addr, len, DMA_FROM_DEVICE);
} }
static inline static inline
@ -460,10 +460,10 @@ void free_descriptor_buffer(struct b43legacy_dmaring *ring,
static int alloc_ringmemory(struct b43legacy_dmaring *ring) static int alloc_ringmemory(struct b43legacy_dmaring *ring)
{ {
/* GFP flags must match the flags in free_ringmemory()! */ /* GFP flags must match the flags in free_ringmemory()! */
ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev, ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
B43legacy_DMA_RINGMEMSIZE, B43legacy_DMA_RINGMEMSIZE,
&(ring->dmabase), &(ring->dmabase),
GFP_KERNEL); GFP_KERNEL);
if (!ring->descbase) { if (!ring->descbase) {
b43legacyerr(ring->dev->wl, "DMA ringmemory allocation" b43legacyerr(ring->dev->wl, "DMA ringmemory allocation"
" failed\n"); " failed\n");
@ -476,8 +476,8 @@ static int alloc_ringmemory(struct b43legacy_dmaring *ring)
static void free_ringmemory(struct b43legacy_dmaring *ring) static void free_ringmemory(struct b43legacy_dmaring *ring)
{ {
ssb_dma_free_consistent(ring->dev->dev, B43legacy_DMA_RINGMEMSIZE, dma_free_coherent(ring->dev->dev->dma_dev, B43legacy_DMA_RINGMEMSIZE,
ring->descbase, ring->dmabase, GFP_KERNEL); ring->descbase, ring->dmabase);
} }
/* Reset the RX DMA channel */ /* Reset the RX DMA channel */
@ -589,7 +589,7 @@ static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
size_t buffersize, size_t buffersize,
bool dma_to_device) bool dma_to_device)
{ {
if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr)))
return 1; return 1;
switch (ring->type) { switch (ring->type) {
@ -906,7 +906,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
goto err_kfree_meta; goto err_kfree_meta;
/* test for ability to dma to txhdr_cache */ /* test for ability to dma to txhdr_cache */
dma_test = ssb_dma_map_single(dev->dev, ring->txhdr_cache, dma_test = dma_map_single(dev->dev->dma_dev, ring->txhdr_cache,
sizeof(struct b43legacy_txhdr_fw3), sizeof(struct b43legacy_txhdr_fw3),
DMA_TO_DEVICE); DMA_TO_DEVICE);
@ -920,7 +920,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
if (!ring->txhdr_cache) if (!ring->txhdr_cache)
goto err_kfree_meta; goto err_kfree_meta;
dma_test = ssb_dma_map_single(dev->dev, dma_test = dma_map_single(dev->dev->dma_dev,
ring->txhdr_cache, ring->txhdr_cache,
sizeof(struct b43legacy_txhdr_fw3), sizeof(struct b43legacy_txhdr_fw3),
DMA_TO_DEVICE); DMA_TO_DEVICE);
@ -930,9 +930,9 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
goto err_kfree_txhdr_cache; goto err_kfree_txhdr_cache;
} }
ssb_dma_unmap_single(dev->dev, dma_test, dma_unmap_single(dev->dev->dma_dev, dma_test,
sizeof(struct b43legacy_txhdr_fw3), sizeof(struct b43legacy_txhdr_fw3),
DMA_TO_DEVICE); DMA_TO_DEVICE);
} }
ring->nr_slots = nr_slots; ring->nr_slots = nr_slots;
@ -1040,9 +1040,12 @@ static int b43legacy_dma_set_mask(struct b43legacy_wldev *dev, u64 mask)
/* Try to set the DMA mask. If it fails, try falling back to a /* Try to set the DMA mask. If it fails, try falling back to a
* lower mask, as we can always also support a lower one. */ * lower mask, as we can always also support a lower one. */
while (1) { while (1) {
err = ssb_dma_set_mask(dev->dev, mask); err = dma_set_mask(dev->dev->dma_dev, mask);
if (!err) if (!err) {
break; err = dma_set_coherent_mask(dev->dev->dma_dev, mask);
if (!err)
break;
}
if (mask == DMA_BIT_MASK(64)) { if (mask == DMA_BIT_MASK(64)) {
mask = DMA_BIT_MASK(32); mask = DMA_BIT_MASK(32);
fallback = 1; fallback = 1;