aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec_mpc52xx.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-03-31 16:16:52 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-02 03:57:00 -0400
commit461cadbc62b098b49b55de10605d330c8b494889 (patch)
tree11c39ee9cc99d7d9acb28a7626f7ae926f4bed76 /drivers/net/fec_mpc52xx.c
parentfa9a86ddc8ecd2830a5e773facc250f110300ae7 (diff)
net/fec_mpc52xx: fix BUG on missing dma_ops
The driver triggers a BUG_ON() when allocating DMA buffers because the arch/powerpc dma_ops aren't in the net_device's struct device. This patch fixes the problem by using the parent of_device which does have the correct dma_ops set. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Reviewed-by: Becky Bruce <beckyb@kernel.crashing.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fec_mpc52xx.c')
-rw-r--r--drivers/net/fec_mpc52xx.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index cd8e98b45ec5..024b10a0bec8 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct net_device *dev, struct bcom_task
129 struct sk_buff *skb; 129 struct sk_buff *skb;
130 130
131 skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)&bd); 131 skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)&bd);
132 dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_FROM_DEVICE); 132 dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len,
133 DMA_FROM_DEVICE);
133 kfree_skb(skb); 134 kfree_skb(skb);
134 } 135 }
135} 136}
@@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct net_device *dev, struct bcom_task
150 bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk); 151 bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk);
151 152
152 bd->status = FEC_RX_BUFFER_SIZE; 153 bd->status = FEC_RX_BUFFER_SIZE;
153 bd->skb_pa = dma_map_single(&dev->dev, skb->data, 154 bd->skb_pa = dma_map_single(dev->dev.parent, skb->data,
154 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); 155 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
155 156
156 bcom_submit_next_buffer(rxtsk, skb); 157 bcom_submit_next_buffer(rxtsk, skb);
@@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *d
388 bcom_prepare_next_buffer(priv->tx_dmatsk); 389 bcom_prepare_next_buffer(priv->tx_dmatsk);
389 390
390 bd->status = skb->len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC; 391 bd->status = skb->len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC;
391 bd->skb_pa = dma_map_single(&dev->dev, skb->data, skb->len, DMA_TO_DEVICE); 392 bd->skb_pa = dma_map_single(dev->dev.parent, skb->data, skb->len,
393 DMA_TO_DEVICE);
392 394
393 bcom_submit_next_buffer(priv->tx_dmatsk, skb); 395 bcom_submit_next_buffer(priv->tx_dmatsk, skb);
394 396
@@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id)
430 struct bcom_fec_bd *bd; 432 struct bcom_fec_bd *bd;
431 skb = bcom_retrieve_buffer(priv->tx_dmatsk, NULL, 433 skb = bcom_retrieve_buffer(priv->tx_dmatsk, NULL,
432 (struct bcom_bd **)&bd); 434 (struct bcom_bd **)&bd);
433 dma_unmap_single(&dev->dev, bd->skb_pa, skb->len, DMA_TO_DEVICE); 435 dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len,
436 DMA_TO_DEVICE);
434 437
435 dev_kfree_skb_irq(skb); 438 dev_kfree_skb_irq(skb);
436 } 439 }
@@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
455 458
456 rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status, 459 rskb = bcom_retrieve_buffer(priv->rx_dmatsk, &status,
457 (struct bcom_bd **)&bd); 460 (struct bcom_bd **)&bd);
458 dma_unmap_single(&dev->dev, bd->skb_pa, rskb->len, DMA_FROM_DEVICE); 461 dma_unmap_single(dev->dev.parent, bd->skb_pa, rskb->len,
462 DMA_FROM_DEVICE);
459 463
460 /* Test for errors in received frame */ 464 /* Test for errors in received frame */
461 if (status & BCOM_FEC_RX_BD_ERRORS) { 465 if (status & BCOM_FEC_RX_BD_ERRORS) {
@@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
464 bcom_prepare_next_buffer(priv->rx_dmatsk); 468 bcom_prepare_next_buffer(priv->rx_dmatsk);
465 469
466 bd->status = FEC_RX_BUFFER_SIZE; 470 bd->status = FEC_RX_BUFFER_SIZE;
467 bd->skb_pa = dma_map_single(&dev->dev, rskb->data, 471 bd->skb_pa = dma_map_single(dev->dev.parent,
472 rskb->data,
468 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); 473 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
469 474
470 bcom_submit_next_buffer(priv->rx_dmatsk, rskb); 475 bcom_submit_next_buffer(priv->rx_dmatsk, rskb);
@@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id)
499 bcom_prepare_next_buffer(priv->rx_dmatsk); 504 bcom_prepare_next_buffer(priv->rx_dmatsk);
500 505
501 bd->status = FEC_RX_BUFFER_SIZE; 506 bd->status = FEC_RX_BUFFER_SIZE;
502 bd->skb_pa = dma_map_single(&dev->dev, skb->data, 507 bd->skb_pa = dma_map_single(dev->dev.parent, skb->data,
503 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); 508 FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE);
504 509
505 bcom_submit_next_buffer(priv->rx_dmatsk, skb); 510 bcom_submit_next_buffer(priv->rx_dmatsk, skb);