Commit f876f59e authored by ZHAO Gang's avatar ZHAO Gang Committed by Greg Kroah-Hartman

staging: et131x: reduce split lines in et131x_rx_dma_memory_free

Signed-off-by: default avatarZHAO Gang <gamerh2o@gmail.com>
Acked-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bad5d26f
...@@ -2281,6 +2281,7 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -2281,6 +2281,7 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
u32 pktstat_ringsize; u32 pktstat_ringsize;
struct rfd *rfd; struct rfd *rfd;
struct rx_ring *rx_ring; struct rx_ring *rx_ring;
struct fbr_lookup *fbr;
/* Setup some convenience pointers */ /* Setup some convenience pointers */
rx_ring = &adapter->rx_ring; rx_ring = &adapter->rx_ring;
...@@ -2299,34 +2300,35 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) ...@@ -2299,34 +2300,35 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
/* Free Free Buffer Rings */ /* Free Free Buffer Rings */
for (id = 0; id < NUM_FBRS; id++) { for (id = 0; id < NUM_FBRS; id++) {
if (!rx_ring->fbr[id]->ring_virtaddr) fbr = rx_ring->fbr[id];
if (!fbr->ring_virtaddr)
continue; continue;
/* First the packet memory */ /* First the packet memory */
for (index = 0; for (index = 0;
index < (rx_ring->fbr[id]->num_entries / FBR_CHUNKS); index < fbr->num_entries / FBR_CHUNKS;
index++) { index++) {
if (rx_ring->fbr[id]->mem_virtaddrs[index]) { if (fbr->mem_virtaddrs[index]) {
bufsize = bufsize = fbr->buffsize * FBR_CHUNKS;
rx_ring->fbr[id]->buffsize * FBR_CHUNKS;
dma_free_coherent(&adapter->pdev->dev, dma_free_coherent(&adapter->pdev->dev,
bufsize, bufsize,
rx_ring->fbr[id]->mem_virtaddrs[index], fbr->mem_virtaddrs[index],
rx_ring->fbr[id]->mem_physaddrs[index]); fbr->mem_physaddrs[index]);
rx_ring->fbr[id]->mem_virtaddrs[index] = NULL; fbr->mem_virtaddrs[index] = NULL;
} }
} }
bufsize = bufsize = sizeof(struct fbr_desc) * fbr->num_entries;
sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries;
dma_free_coherent(&adapter->pdev->dev, bufsize, dma_free_coherent(&adapter->pdev->dev,
rx_ring->fbr[id]->ring_virtaddr, bufsize,
rx_ring->fbr[id]->ring_physaddr); fbr->ring_virtaddr,
fbr->ring_physaddr);
rx_ring->fbr[id]->ring_virtaddr = NULL; fbr->ring_virtaddr = NULL;
} }
/* Free Packet Status Ring */ /* Free Packet Status Ring */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment