Message ID | 20190625102932.32257-2-hch@lst.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 258989000849a48ff21400cf90c93be3f08d0582 |
Delegated to: | Kalle Valo |
Headers | show |
Series | [1/4] b43legacy: remove b43legacy_dma_set_mask | expand |
On 6/25/19 5:29 AM, Christoph Hellwig wrote: > 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: Christoph Hellwig <hch@lst.de> > --- > drivers/net/wireless/broadcom/b43legacy/dma.c | 39 +------------------ > 1 file changed, 1 insertion(+), 38 deletions(-) The patches work for PPC32 for both b43legacy and b43. Tested-by: Larry Finger <Larry.Finger@lwfinger.net> Thanks, Larry > > diff --git a/drivers/net/wireless/broadcom/b43legacy/dma.c b/drivers/net/wireless/broadcom/b43legacy/dma.c > index 2ce1537d983c..0c2de20622e3 100644 > --- a/drivers/net/wireless/broadcom/b43legacy/dma.c > +++ b/drivers/net/wireless/broadcom/b43legacy/dma.c > @@ -797,43 +797,6 @@ void b43legacy_dma_free(struct b43legacy_wldev *dev) > dma->tx_ring0 = NULL; > } > > -static int b43legacy_dma_set_mask(struct b43legacy_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; > - } > - b43legacyerr(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) { > - b43legacyinfo(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; > -} > - > int b43legacy_dma_init(struct b43legacy_wldev *dev) > { > struct b43legacy_dma *dma = &dev->dma; > @@ -844,7 +807,7 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev) > > dmamask = supported_dma_mask(dev); > type = dma_mask_to_engine_type(dmamask); > - err = b43legacy_dma_set_mask(dev, dmamask); > + err = dma_set_mask_and_coherent(dev->dev->dma_dev, dmamask); > if (err) { > #ifdef CONFIG_B43LEGACY_PIO > b43legacywarn(dev->wl, "DMA for this device not supported. " >
Christoph Hellwig <hch@lst.de> wrote: > 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: Christoph Hellwig <hch@lst.de> > Tested-by: Larry Finger <Larry.Finger@lwfinger.net> 4 patches applied to wireless-drivers-next.git, thanks. 258989000849 b43legacy: remove b43legacy_dma_set_mask 80372782e4cb b43legacy: simplify engine type / DMA mask selection c897523febae b43: remove b43_dma_set_mask 288aa4ee7acf b43: simplify engine type / DMA mask selection
diff --git a/drivers/net/wireless/broadcom/b43legacy/dma.c b/drivers/net/wireless/broadcom/b43legacy/dma.c index 2ce1537d983c..0c2de20622e3 100644 --- a/drivers/net/wireless/broadcom/b43legacy/dma.c +++ b/drivers/net/wireless/broadcom/b43legacy/dma.c @@ -797,43 +797,6 @@ void b43legacy_dma_free(struct b43legacy_wldev *dev) dma->tx_ring0 = NULL; } -static int b43legacy_dma_set_mask(struct b43legacy_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; - } - b43legacyerr(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) { - b43legacyinfo(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; -} - int b43legacy_dma_init(struct b43legacy_wldev *dev) { struct b43legacy_dma *dma = &dev->dma; @@ -844,7 +807,7 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev) dmamask = supported_dma_mask(dev); type = dma_mask_to_engine_type(dmamask); - err = b43legacy_dma_set_mask(dev, dmamask); + err = dma_set_mask_and_coherent(dev->dev->dma_dev, dmamask); if (err) { #ifdef CONFIG_B43LEGACY_PIO b43legacywarn(dev->wl, "DMA for this device not supported. "
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: Christoph Hellwig <hch@lst.de> --- drivers/net/wireless/broadcom/b43legacy/dma.c | 39 +------------------ 1 file changed, 1 insertion(+), 38 deletions(-)