summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-02-11 15:12:08 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-02-11 15:12:08 +0000
commitaac3ad4c0eb2d3089f4127c5d923420324a5212b (patch)
treed7819af072fea4e058c98c0c36ae361ef179746c
parent1fd8724e94190dd8f2c893ea6dd7e72cdc8f36eb (diff)
downloadmtk-20170518-aac3ad4c0eb2d3089f4127c5d923420324a5212b.zip
mtk-20170518-aac3ad4c0eb2d3089f4127c5d923420324a5212b.tar.gz
mtk-20170518-aac3ad4c0eb2d3089f4127c5d923420324a5212b.tar.bz2
ramips: raeth: use device pointer in DMA API calls
SVN-Revision: 30449
-rw-r--r--target/linux/ramips/files/drivers/net/ramips.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c
index 3ee8e82..1ec03b1 100644
--- a/target/linux/ramips/files/drivers/net/ramips.c
+++ b/target/linux/ramips/files/drivers/net/ramips.c
@@ -129,18 +129,18 @@ ramips_cleanup_dma(struct raeth_priv *re)
for (i = 0; i < NUM_RX_DESC; i++)
if (re->rx_skb[i]) {
- dma_unmap_single(NULL, re->rx_dma[i], MAX_RX_LENGTH,
- DMA_FROM_DEVICE);
+ dma_unmap_single(&re->netdev->dev, re->rx_dma[i],
+ MAX_RX_LENGTH, DMA_FROM_DEVICE);
dev_kfree_skb_any(re->rx_skb[i]);
}
if (re->rx)
- dma_free_coherent(NULL,
+ dma_free_coherent(&re->netdev->dev,
NUM_RX_DESC * sizeof(struct ramips_rx_dma),
re->rx, re->rx_desc_dma);
if (re->tx)
- dma_free_coherent(NULL,
+ dma_free_coherent(&re->netdev->dev,
NUM_TX_DESC * sizeof(struct ramips_tx_dma),
re->tx, re->tx_desc_dma);
}
@@ -154,7 +154,7 @@ ramips_alloc_dma(struct raeth_priv *re)
re->skb_free_idx = 0;
/* setup tx ring */
- re->tx = dma_alloc_coherent(NULL,
+ re->tx = dma_alloc_coherent(&re->netdev->dev,
NUM_TX_DESC * sizeof(struct ramips_tx_dma),
&re->tx_desc_dma, GFP_ATOMIC);
if (!re->tx)
@@ -167,7 +167,7 @@ ramips_alloc_dma(struct raeth_priv *re)
}
/* setup rx ring */
- re->rx = dma_alloc_coherent(NULL,
+ re->rx = dma_alloc_coherent(&re->netdev->dev,
NUM_RX_DESC * sizeof(struct ramips_rx_dma),
&re->rx_desc_dma, GFP_ATOMIC);
if (!re->rx)
@@ -184,7 +184,7 @@ ramips_alloc_dma(struct raeth_priv *re)
skb_reserve(new_skb, NET_IP_ALIGN);
- dma_addr = dma_map_single(NULL, new_skb->data,
+ dma_addr = dma_map_single(&re->netdev->dev, new_skb->data,
MAX_RX_LENGTH, DMA_FROM_DEVICE);
re->rx_dma[i] = dma_addr;
re->rx[i].rxd1 = (unsigned int) re->rx_dma[i];
@@ -234,7 +234,8 @@ ramips_eth_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
dev->trans_start = jiffies;
- mapped_addr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
+ mapped_addr = dma_map_single(&priv->netdev->dev, skb->data, skb->len,
+ DMA_TO_DEVICE);
spin_lock(&priv->page_lock);
tx = ramips_fe_rr(RAMIPS_TX_CTX_IDX0);
@@ -288,8 +289,8 @@ ramips_eth_rx_hw(unsigned long ptr)
if (new_skb) {
dma_addr_t dma_addr;
- dma_unmap_single(NULL, priv->rx_dma[rx], MAX_RX_LENGTH,
- DMA_FROM_DEVICE);
+ dma_unmap_single(&priv->netdev->dev, priv->rx_dma[rx],
+ MAX_RX_LENGTH, DMA_FROM_DEVICE);
skb_put(rx_skb, pktlen);
rx_skb->dev = dev;
@@ -302,7 +303,7 @@ ramips_eth_rx_hw(unsigned long ptr)
priv->rx_skb[rx] = new_skb;
skb_reserve(new_skb, NET_IP_ALIGN);
- dma_addr = dma_map_single(NULL,
+ dma_addr = dma_map_single(&priv->netdev->dev,
new_skb->data,
MAX_RX_LENGTH,
DMA_FROM_DEVICE);