OSDN Git Service

au1000_eth: pass struct device to DMA API functions
authorChristoph Hellwig <hch@lst.de>
Mon, 11 Feb 2019 13:19:58 +0000 (14:19 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Feb 2019 17:09:23 +0000 (12:09 -0500)
The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/au1000_eth.c

index e833d1b..e5073ae 100644 (file)
@@ -1167,7 +1167,7 @@ static int au1000_probe(struct platform_device *pdev)
        /* Allocate the data buffers
         * Snooping works fine with eth on all au1xxx
         */
-       aup->vaddr = (u32)dma_alloc_attrs(NULL, MAX_BUF_SIZE *
+       aup->vaddr = (u32)dma_alloc_attrs(&pdev->dev, MAX_BUF_SIZE *
                                          (NUM_TX_BUFFS + NUM_RX_BUFFS),
                                          &aup->dma_addr, 0,
                                          DMA_ATTR_NON_CONSISTENT);
@@ -1349,7 +1349,7 @@ err_remap3:
 err_remap2:
        iounmap(aup->mac);
 err_remap1:
-       dma_free_attrs(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
+       dma_free_attrs(&pdev->dev, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
                        (void *)aup->vaddr, aup->dma_addr,
                        DMA_ATTR_NON_CONSISTENT);
 err_vaddr:
@@ -1383,7 +1383,7 @@ static int au1000_remove(struct platform_device *pdev)
                if (aup->tx_db_inuse[i])
                        au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
 
-       dma_free_attrs(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
+       dma_free_attrs(&pdev->dev, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
                        (void *)aup->vaddr, aup->dma_addr,
                        DMA_ATTR_NON_CONSISTENT);