diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-01-20 11:26:38 +0300 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-02-15 11:26:30 +0300 |
commit | d1ab1f54a1b0fb0ae6479fad6e26983f09fd263a (patch) | |
tree | 29a01abd508b85dacc5c60c46e83575559f90e1b /drivers/net/fec.c | |
parent | 45993653bd5935dbf975bc26a834f2ff23c9f914 (diff) | |
download | linux-d1ab1f54a1b0fb0ae6479fad6e26983f09fd263a.tar.xz |
net/fec: provide device for dma functions and matching sizes for map and unmap
This fixes warnings when CONFIG_DMA_API_DEBUG=y:
NULL NULL: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x000000004781a020] [size=64 bytes]
net eth0: DMA-API: device driver frees DMA memory with different size [device address=0x000000004781a020] [map size=2048 bytes] [unmap size=64 bytes]
Moreover pass the platform device to dma_{,un}map_single which makes
more sense because the logical network device doesn't know anything
about dma.
Passing the platform device was a suggestion by Lothar Waßmann.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r-- | drivers/net/fec.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 3f5dfe2e41ac..0c984d6b25f6 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -297,7 +297,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) /* Push the data cache so the CPM does not get stale memory * data. */ - bdp->cbd_bufaddr = dma_map_single(&ndev->dev, bufaddr, + bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr, FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); /* Send it on its way. Tell FEC it's ready, interrupt when done, @@ -497,7 +497,8 @@ fec_enet_tx(struct net_device *ndev) if (bdp == fep->cur_tx && fep->tx_full == 0) break; - dma_unmap_single(&ndev->dev, bdp->cbd_bufaddr, FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); + dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, + FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); bdp->cbd_bufaddr = 0; skb = fep->tx_skbuff[fep->skb_dirty]; @@ -624,8 +625,8 @@ fec_enet_rx(struct net_device *ndev) ndev->stats.rx_bytes += pkt_len; data = (__u8*)__va(bdp->cbd_bufaddr); - dma_unmap_single(NULL, bdp->cbd_bufaddr, bdp->cbd_datlen, - DMA_FROM_DEVICE); + dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, + FEC_ENET_TX_FRSIZE, DMA_FROM_DEVICE); if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) swap_buffer(data, pkt_len); @@ -649,8 +650,8 @@ fec_enet_rx(struct net_device *ndev) netif_rx(skb); } - bdp->cbd_bufaddr = dma_map_single(NULL, data, bdp->cbd_datlen, - DMA_FROM_DEVICE); + bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, data, + FEC_ENET_TX_FRSIZE, DMA_FROM_DEVICE); rx_processing_done: /* Clear the status flags for this buffer */ status &= ~BD_ENET_RX_STATS; @@ -1075,7 +1076,7 @@ static void fec_enet_free_buffers(struct net_device *ndev) skb = fep->rx_skbuff[i]; if (bdp->cbd_bufaddr) - dma_unmap_single(&ndev->dev, bdp->cbd_bufaddr, + dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE); if (skb) dev_kfree_skb(skb); @@ -1103,7 +1104,7 @@ static int fec_enet_alloc_buffers(struct net_device *ndev) } fep->rx_skbuff[i] = skb; - bdp->cbd_bufaddr = dma_map_single(&ndev->dev, skb->data, + bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, skb->data, FEC_ENET_RX_FRSIZE, DMA_FROM_DEVICE); bdp->cbd_sc = BD_ENET_RX_EMPTY; bdp++; |