diff options
| author | Peter Senna Tschudin <peter.senna@gmail.com> | 2014-03-15 19:30:52 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-03-17 17:19:45 -0400 |
| commit | 8d7f1fbf083e19688619e6ca25c95434a2c30537 (patch) | |
| tree | c67d8e511502023e108ab808b367e8d34cb46ec6 | |
| parent | ee7d07e7940c73dc004a9e22e9c3b34b7a9d810e (diff) | |
ATHEROS-ALX: Use dma_set_mask_and_coherent and fix a bug
1. For the 64 bits dma mask use dma_set_mask_and_coherent instead of
dma_set_mask and dma_set_coherent_mask.
2. For the 32 bits dma mask dma_set_coherent_mask is only called if
dma_set_mask fails, which is unusual. Assuming this as a bug, fixes
it by replacing calls to dma_set_mask and dma_set_coherent_mask by a
call to dma_set_mask_and_coherent.
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Tested-by: Jonas Hahnfeld <hahnjo@hahnjo.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/atheros/alx/main.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index 2e45f6ec1bf0..380d24922049 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
| @@ -1248,19 +1248,13 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 1248 | * shared register for the high 32 bits, so only a single, aligned, | 1248 | * shared register for the high 32 bits, so only a single, aligned, |
| 1249 | * 4 GB physical address range can be used for descriptors. | 1249 | * 4 GB physical address range can be used for descriptors. |
| 1250 | */ | 1250 | */ |
| 1251 | if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) && | 1251 | if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { |
| 1252 | !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { | ||
| 1253 | dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n"); | 1252 | dev_dbg(&pdev->dev, "DMA to 64-BIT addresses\n"); |
| 1254 | } else { | 1253 | } else { |
| 1255 | err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); | 1254 | err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
| 1256 | if (err) { | 1255 | if (err) { |
| 1257 | err = dma_set_coherent_mask(&pdev->dev, | 1256 | dev_err(&pdev->dev, "No usable DMA config, aborting\n"); |
| 1258 | DMA_BIT_MASK(32)); | 1257 | goto out_pci_disable; |
| 1259 | if (err) { | ||
| 1260 | dev_err(&pdev->dev, | ||
| 1261 | "No usable DMA config, aborting\n"); | ||
| 1262 | goto out_pci_disable; | ||
| 1263 | } | ||
| 1264 | } | 1258 | } |
| 1265 | } | 1259 | } |
| 1266 | 1260 | ||
