diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 63c2cc408e15..17148bb24426 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -60,14 +60,15 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, | |||
60 | } | 60 | } |
61 | EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); | 61 | EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); |
62 | 62 | ||
63 | void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | 63 | bool rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) |
64 | { | 64 | { |
65 | struct data_queue *queue = rt2x00dev->rx; | 65 | struct data_queue *queue = rt2x00dev->rx; |
66 | struct queue_entry *entry; | 66 | struct queue_entry *entry; |
67 | struct queue_entry_priv_pci *entry_priv; | 67 | struct queue_entry_priv_pci *entry_priv; |
68 | struct skb_frame_desc *skbdesc; | 68 | struct skb_frame_desc *skbdesc; |
69 | int max_rx = 16; | ||
69 | 70 | ||
70 | while (1) { | 71 | while (--max_rx) { |
71 | entry = rt2x00queue_get_entry(queue, Q_INDEX); | 72 | entry = rt2x00queue_get_entry(queue, Q_INDEX); |
72 | entry_priv = entry->priv_data; | 73 | entry_priv = entry->priv_data; |
73 | 74 | ||
@@ -82,13 +83,31 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
82 | skbdesc->desc_len = entry->queue->desc_size; | 83 | skbdesc->desc_len = entry->queue->desc_size; |
83 | 84 | ||
84 | /* | 85 | /* |
86 | * DMA is already done, notify rt2x00lib that | ||
87 | * it finished successfully. | ||
88 | */ | ||
89 | rt2x00lib_dmastart(entry); | ||
90 | rt2x00lib_dmadone(entry); | ||
91 | |||
92 | /* | ||
85 | * Send the frame to rt2x00lib for further processing. | 93 | * Send the frame to rt2x00lib for further processing. |
86 | */ | 94 | */ |
87 | rt2x00lib_rxdone(rt2x00dev, entry); | 95 | rt2x00lib_rxdone(entry); |
88 | } | 96 | } |
97 | |||
98 | return !max_rx; | ||
89 | } | 99 | } |
90 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); | 100 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); |
91 | 101 | ||
102 | void rt2x00pci_flush_queue(struct data_queue *queue, bool drop) | ||
103 | { | ||
104 | unsigned int i; | ||
105 | |||
106 | for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) | ||
107 | msleep(10); | ||
108 | } | ||
109 | EXPORT_SYMBOL_GPL(rt2x00pci_flush_queue); | ||
110 | |||
92 | /* | 111 | /* |
93 | * Device initialization handlers. | 112 | * Device initialization handlers. |
94 | */ | 113 | */ |
@@ -105,7 +124,7 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, | |||
105 | */ | 124 | */ |
106 | addr = dma_alloc_coherent(rt2x00dev->dev, | 125 | addr = dma_alloc_coherent(rt2x00dev->dev, |
107 | queue->limit * queue->desc_size, | 126 | queue->limit * queue->desc_size, |
108 | &dma, GFP_KERNEL | GFP_DMA); | 127 | &dma, GFP_KERNEL); |
109 | if (!addr) | 128 | if (!addr) |
110 | return -ENOMEM; | 129 | return -ENOMEM; |
111 | 130 | ||
@@ -153,10 +172,9 @@ int rt2x00pci_initialize(struct rt2x00_dev *rt2x00dev) | |||
153 | /* | 172 | /* |
154 | * Register interrupt handler. | 173 | * Register interrupt handler. |
155 | */ | 174 | */ |
156 | status = request_threaded_irq(rt2x00dev->irq, | 175 | status = request_irq(rt2x00dev->irq, |
157 | rt2x00dev->ops->lib->irq_handler, | 176 | rt2x00dev->ops->lib->irq_handler, |
158 | rt2x00dev->ops->lib->irq_handler_thread, | 177 | IRQF_SHARED, rt2x00dev->name, rt2x00dev); |
159 | IRQF_SHARED, rt2x00dev->name, rt2x00dev); | ||
160 | if (status) { | 178 | if (status) { |
161 | ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", | 179 | ERROR(rt2x00dev, "IRQ %d allocation failed (error %d).\n", |
162 | rt2x00dev->irq, status); | 180 | rt2x00dev->irq, status); |
@@ -233,9 +251,8 @@ exit: | |||
233 | return -ENOMEM; | 251 | return -ENOMEM; |
234 | } | 252 | } |
235 | 253 | ||
236 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) | 254 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops) |
237 | { | 255 | { |
238 | struct rt2x00_ops *ops = (struct rt2x00_ops *)id->driver_data; | ||
239 | struct ieee80211_hw *hw; | 256 | struct ieee80211_hw *hw; |
240 | struct rt2x00_dev *rt2x00dev; | 257 | struct rt2x00_dev *rt2x00dev; |
241 | int retval; | 258 | int retval; |
@@ -279,7 +296,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) | |||
279 | rt2x00dev->irq = pci_dev->irq; | 296 | rt2x00dev->irq = pci_dev->irq; |
280 | rt2x00dev->name = pci_name(pci_dev); | 297 | rt2x00dev->name = pci_name(pci_dev); |
281 | 298 | ||
282 | if (pci_dev->is_pcie) | 299 | if (pci_is_pcie(pci_dev)) |
283 | rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE); | 300 | rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE); |
284 | else | 301 | else |
285 | rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); | 302 | rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); |
@@ -356,12 +373,12 @@ int rt2x00pci_resume(struct pci_dev *pci_dev) | |||
356 | struct rt2x00_dev *rt2x00dev = hw->priv; | 373 | struct rt2x00_dev *rt2x00dev = hw->priv; |
357 | 374 | ||
358 | if (pci_set_power_state(pci_dev, PCI_D0) || | 375 | if (pci_set_power_state(pci_dev, PCI_D0) || |
359 | pci_enable_device(pci_dev) || | 376 | pci_enable_device(pci_dev)) { |
360 | pci_restore_state(pci_dev)) { | ||
361 | ERROR(rt2x00dev, "Failed to resume device.\n"); | 377 | ERROR(rt2x00dev, "Failed to resume device.\n"); |
362 | return -EIO; | 378 | return -EIO; |
363 | } | 379 | } |
364 | 380 | ||
381 | pci_restore_state(pci_dev); | ||
365 | return rt2x00lib_resume(rt2x00dev); | 382 | return rt2x00lib_resume(rt2x00dev); |
366 | } | 383 | } |
367 | EXPORT_SYMBOL_GPL(rt2x00pci_resume); | 384 | EXPORT_SYMBOL_GPL(rt2x00pci_resume); |