aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 7d2f406937cd..1960d938d73b 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -218,40 +218,44 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,
218 struct pci_dev *pci_dev = rt2x00dev_pci(rt2x00dev); 218 struct pci_dev *pci_dev = rt2x00dev_pci(rt2x00dev);
219 struct queue_entry_priv_pci_rx *priv_rx; 219 struct queue_entry_priv_pci_rx *priv_rx;
220 struct queue_entry_priv_pci_tx *priv_tx; 220 struct queue_entry_priv_pci_tx *priv_tx;
221 void *desc; 221 void *addr;
222 dma_addr_t dma;
223 void *desc_addr;
224 dma_addr_t desc_dma;
222 void *data_addr; 225 void *data_addr;
223 void *data;
224 dma_addr_t data_dma; 226 dma_addr_t data_dma;
225 dma_addr_t dma;
226 unsigned int i; 227 unsigned int i;
227 228
228 /* 229 /*
229 * Allocate DMA memory for descriptor and buffer. 230 * Allocate DMA memory for descriptor and buffer.
230 */ 231 */
231 data_addr = pci_alloc_consistent(pci_dev, dma_size(queue), &data_dma); 232 addr = pci_alloc_consistent(pci_dev, dma_size(queue), &dma);
232 if (!data_addr) 233 if (!addr)
233 return -ENOMEM; 234 return -ENOMEM;
234 235
235 memset(data_addr, 0, dma_size(queue)); 236 memset(addr, 0, dma_size(queue));
236 237
237 /* 238 /*
238 * Initialize all queue entries to contain valid addresses. 239 * Initialize all queue entries to contain valid addresses.
239 */ 240 */
240 for (i = 0; i < queue->limit; i++) { 241 for (i = 0; i < queue->limit; i++) {
241 desc = desc_offset(queue, data_addr, i); 242 desc_addr = desc_offset(queue, addr, i);
242 data = data_offset(queue, data_addr, i); 243 desc_dma = desc_offset(queue, dma, i);
243 dma = data_offset(queue, data_dma, i); 244 data_addr = data_offset(queue, addr, i);
245 data_dma = data_offset(queue, dma, i);
244 246
245 if (queue->qid == QID_RX) { 247 if (queue->qid == QID_RX) {
246 priv_rx = queue->entries[i].priv_data; 248 priv_rx = queue->entries[i].priv_data;
247 priv_rx->desc = desc; 249 priv_rx->desc = desc_addr;
248 priv_rx->data = data; 250 priv_rx->desc_dma = desc_dma;
249 priv_rx->dma = dma; 251 priv_rx->data = data_addr;
252 priv_rx->data_dma = data_dma;
250 } else { 253 } else {
251 priv_tx = queue->entries[i].priv_data; 254 priv_tx = queue->entries[i].priv_data;
252 priv_tx->desc = desc; 255 priv_tx->desc = desc_addr;
253 priv_tx->data = data; 256 priv_tx->desc_dma = desc_dma;
254 priv_tx->dma = dma; 257 priv_tx->data = data_addr;
258 priv_tx->data_dma = data_dma;
255 } 259 }
256 } 260 }
257 261
@@ -270,13 +274,13 @@ static void rt2x00pci_free_queue_dma(struct rt2x00_dev *rt2x00dev,
270 if (queue->qid == QID_RX) { 274 if (queue->qid == QID_RX) {
271 priv_rx = queue->entries[0].priv_data; 275 priv_rx = queue->entries[0].priv_data;
272 data_addr = priv_rx->data; 276 data_addr = priv_rx->data;
273 data_dma = priv_rx->dma; 277 data_dma = priv_rx->data_dma;
274 278
275 priv_rx->data = NULL; 279 priv_rx->data = NULL;
276 } else { 280 } else {
277 priv_tx = queue->entries[0].priv_data; 281 priv_tx = queue->entries[0].priv_data;
278 data_addr = priv_tx->data; 282 data_addr = priv_tx->data;
279 data_dma = priv_tx->dma; 283 data_dma = priv_tx->data_dma;
280 284
281 priv_tx->data = NULL; 285 priv_tx->data = NULL;
282 } 286 }