Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203427
b: refs/heads/master
c: 301e9d9
h: refs/heads/master
i:
  203425: 1b6db69
  203423: bcfc0fd
v: v3
  • Loading branch information
Denis Kirjanov authored and David S. Miller committed Jul 9, 2010
1 parent 5445831 commit 708d3ef
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 47562e5d325af9ce5306bce53eb7cdd353fe46be
refs/heads/master: 301e9d96bf65292f916a3936d63c504ac7792ee6
32 changes: 32 additions & 0 deletions trunk/drivers/net/ll_temac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,35 @@ static int temac_dcr_setup(struct temac_local *lp, struct of_device *op,

#endif

/**
* * temac_dma_bd_release - Release buffer descriptor rings
*/
static void temac_dma_bd_release(struct net_device *ndev)
{
struct temac_local *lp = netdev_priv(ndev);
int i;

for (i = 0; i < RX_BD_NUM; i++) {
if (!lp->rx_skb[i])
break;
else {
dma_unmap_single(ndev->dev.parent, lp->rx_bd_v[i].phys,
XTE_MAX_JUMBO_FRAME_SIZE, DMA_FROM_DEVICE);
dev_kfree_skb(lp->rx_skb[i]);
}
}
if (lp->rx_bd_v)
dma_free_coherent(ndev->dev.parent,
sizeof(*lp->rx_bd_v) * RX_BD_NUM,
lp->rx_bd_v, lp->rx_bd_p);
if (lp->tx_bd_v)
dma_free_coherent(ndev->dev.parent,
sizeof(*lp->tx_bd_v) * TX_BD_NUM,
lp->tx_bd_v, lp->tx_bd_p);
if (lp->rx_skb)
kfree(lp->rx_skb);
}

/**
* temac_dma_bd_init - Setup buffer descriptor rings
*/
Expand Down Expand Up @@ -275,6 +304,7 @@ static int temac_dma_bd_init(struct net_device *ndev)
return 0;

out:
temac_dma_bd_release(ndev);
return -ENOMEM;
}

Expand Down Expand Up @@ -858,6 +888,8 @@ static int temac_stop(struct net_device *ndev)
phy_disconnect(lp->phy_dev);
lp->phy_dev = NULL;

temac_dma_bd_release(ndev);

return 0;
}

Expand Down

0 comments on commit 708d3ef

Please sign in to comment.