Commit c897523f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Kalle Valo

b43: remove b43_dma_set_mask

These days drivers are not required to fallback to smaller DMA masks,
but can just set the largest mask they support, removing the need for
this trial and error logic.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 80372782
...@@ -1043,42 +1043,6 @@ void b43_dma_free(struct b43_wldev *dev) ...@@ -1043,42 +1043,6 @@ void b43_dma_free(struct b43_wldev *dev)
destroy_ring(dma, tx_ring_mcast); destroy_ring(dma, tx_ring_mcast);
} }
static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask)
{
u64 orig_mask = mask;
bool fallback = false;
int err;
/* 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. */
while (1) {
err = dma_set_mask_and_coherent(dev->dev->dma_dev, mask);
if (!err)
break;
if (mask == DMA_BIT_MASK(64)) {
mask = DMA_BIT_MASK(32);
fallback = true;
continue;
}
if (mask == DMA_BIT_MASK(32)) {
mask = DMA_BIT_MASK(30);
fallback = true;
continue;
}
b43err(dev->wl, "The machine/kernel does not support "
"the required %u-bit DMA mask\n",
(unsigned int)dma_mask_to_engine_type(orig_mask));
return -EOPNOTSUPP;
}
if (fallback) {
b43info(dev->wl, "DMA mask fallback from %u-bit to %u-bit\n",
(unsigned int)dma_mask_to_engine_type(orig_mask),
(unsigned int)dma_mask_to_engine_type(mask));
}
return 0;
}
/* Some hardware with 64-bit DMA seems to be bugged and looks for translation /* Some hardware with 64-bit DMA seems to be bugged and looks for translation
* bit in low address word instead of high one. * bit in low address word instead of high one.
*/ */
...@@ -1107,9 +1071,12 @@ int b43_dma_init(struct b43_wldev *dev) ...@@ -1107,9 +1071,12 @@ int b43_dma_init(struct b43_wldev *dev)
dmamask = supported_dma_mask(dev); dmamask = supported_dma_mask(dev);
type = dma_mask_to_engine_type(dmamask); type = dma_mask_to_engine_type(dmamask);
err = b43_dma_set_mask(dev, dmamask); err = dma_set_mask_and_coherent(dev->dev->dma_dev, dmamask);
if (err) if (err) {
b43err(dev->wl, "The machine/kernel does not support "
"the required %u-bit DMA mask\n", type);
return err; return err;
}
switch (dev->dev->bus_type) { switch (dev->dev->bus_type) {
#ifdef CONFIG_B43_BCMA #ifdef CONFIG_B43_BCMA
......
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