aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2010-06-29 15:41:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-30 15:00:50 -0400
commit78eea11b0e6ae5771bc19cc46984f1cdcbbb6ba1 (patch)
tree5c45266d1ccf0c16cdb72d1d1e367c3d35c110c2
parentfe7256971fbaeac868c35c2dbd34a7bbbdc0622b (diff)
rt2x00: Merge PCI and USB versions of write_tx_data into single function.
Now that rt2x00pci_write_tx_data and rt2x00usb_write_tx_data are similar we can merge them in a single function in rt2x00queue.c. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c43
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.h10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c43
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c21
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.h10
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c1
12 files changed, 41 insertions, 93 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 1eb882e15fb4..1ad3596cb41e 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1588,7 +1588,6 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
1588 .reset_tuner = rt2400pci_reset_tuner, 1588 .reset_tuner = rt2400pci_reset_tuner,
1589 .link_tuner = rt2400pci_link_tuner, 1589 .link_tuner = rt2400pci_link_tuner,
1590 .write_tx_desc = rt2400pci_write_tx_desc, 1590 .write_tx_desc = rt2400pci_write_tx_desc,
1591 .write_tx_data = rt2x00pci_write_tx_data,
1592 .write_beacon = rt2400pci_write_beacon, 1591 .write_beacon = rt2400pci_write_beacon,
1593 .kick_tx_queue = rt2400pci_kick_tx_queue, 1592 .kick_tx_queue = rt2400pci_kick_tx_queue,
1594 .kill_tx_queue = rt2400pci_kill_tx_queue, 1593 .kill_tx_queue = rt2400pci_kill_tx_queue,
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index a29cb212f89a..2771ae707a34 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1886,7 +1886,6 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
1886 .reset_tuner = rt2500pci_reset_tuner, 1886 .reset_tuner = rt2500pci_reset_tuner,
1887 .link_tuner = rt2500pci_link_tuner, 1887 .link_tuner = rt2500pci_link_tuner,
1888 .write_tx_desc = rt2500pci_write_tx_desc, 1888 .write_tx_desc = rt2500pci_write_tx_desc,
1889 .write_tx_data = rt2x00pci_write_tx_data,
1890 .write_beacon = rt2500pci_write_beacon, 1889 .write_beacon = rt2500pci_write_beacon,
1891 .kick_tx_queue = rt2500pci_kick_tx_queue, 1890 .kick_tx_queue = rt2500pci_kick_tx_queue,
1892 .kill_tx_queue = rt2500pci_kill_tx_queue, 1891 .kill_tx_queue = rt2500pci_kill_tx_queue,
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 963238c89080..44205526013f 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1779,7 +1779,6 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
1779 .link_stats = rt2500usb_link_stats, 1779 .link_stats = rt2500usb_link_stats,
1780 .reset_tuner = rt2500usb_reset_tuner, 1780 .reset_tuner = rt2500usb_reset_tuner,
1781 .write_tx_desc = rt2500usb_write_tx_desc, 1781 .write_tx_desc = rt2500usb_write_tx_desc,
1782 .write_tx_data = rt2x00usb_write_tx_data,
1783 .write_beacon = rt2500usb_write_beacon, 1782 .write_beacon = rt2500usb_write_beacon,
1784 .get_tx_data_len = rt2500usb_get_tx_data_len, 1783 .get_tx_data_len = rt2500usb_get_tx_data_len,
1785 .kick_tx_queue = rt2x00usb_kick_tx_queue, 1784 .kick_tx_queue = rt2x00usb_kick_tx_queue,
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index e5ea670a18db..615a865351a2 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1044,7 +1044,6 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
1044 .reset_tuner = rt2800_reset_tuner, 1044 .reset_tuner = rt2800_reset_tuner,
1045 .link_tuner = rt2800_link_tuner, 1045 .link_tuner = rt2800_link_tuner,
1046 .write_tx_desc = rt2800pci_write_tx_desc, 1046 .write_tx_desc = rt2800pci_write_tx_desc,
1047 .write_tx_data = rt2x00pci_write_tx_data,
1048 .write_tx_datadesc = rt2800pci_write_tx_datadesc, 1047 .write_tx_datadesc = rt2800pci_write_tx_datadesc,
1049 .write_beacon = rt2800_write_beacon, 1048 .write_beacon = rt2800_write_beacon,
1050 .kick_tx_queue = rt2800pci_kick_tx_queue, 1049 .kick_tx_queue = rt2800pci_kick_tx_queue,
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index f18c12a19cc9..6d4de6080040 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -652,7 +652,6 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
652 .reset_tuner = rt2800_reset_tuner, 652 .reset_tuner = rt2800_reset_tuner,
653 .link_tuner = rt2800_link_tuner, 653 .link_tuner = rt2800_link_tuner,
654 .write_tx_desc = rt2800usb_write_tx_desc, 654 .write_tx_desc = rt2800usb_write_tx_desc,
655 .write_tx_data = rt2x00usb_write_tx_data,
656 .write_beacon = rt2800_write_beacon, 655 .write_beacon = rt2800_write_beacon,
657 .get_tx_data_len = rt2800usb_get_tx_data_len, 656 .get_tx_data_len = rt2800usb_get_tx_data_len,
658 .kick_tx_queue = rt2x00usb_kick_tx_queue, 657 .kick_tx_queue = rt2x00usb_kick_tx_queue,
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 10eaffd12b1b..1c9ccc30b6a4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -61,49 +61,6 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
61EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read); 61EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read);
62 62
63/* 63/*
64 * TX data handlers.
65 */
66int rt2x00pci_write_tx_data(struct queue_entry *entry,
67 struct txentry_desc *txdesc)
68{
69 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
70
71 /*
72 * This should not happen, we already checked the entry
73 * was ours. When the hardware disagrees there has been
74 * a queue corruption!
75 */
76 if (unlikely(rt2x00dev->ops->lib->get_entry_state(entry))) {
77 ERROR(rt2x00dev,
78 "Corrupt queue %d, accessing entry which is not ours.\n"
79 "Please file bug report to %s.\n",
80 entry->queue->qid, DRV_PROJECT);
81 return -EINVAL;
82 }
83
84 /*
85 * Add the requested extra tx headroom in front of the skb.
86 */
87 skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom);
88 memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom);
89
90 /*
91 * Call the driver's write_tx_datadesc function, if it exists.
92 */
93 if (rt2x00dev->ops->lib->write_tx_datadesc)
94 rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
95
96 /*
97 * Map the skb to DMA.
98 */
99 if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
100 rt2x00queue_map_txskb(rt2x00dev, entry->skb);
101
102 return 0;
103}
104EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data);
105
106/*
107 * TX/RX data handlers. 64 * TX/RX data handlers.
108 */ 65 */
109void rt2x00pci_txdone(struct queue_entry *entry, 66void rt2x00pci_txdone(struct queue_entry *entry,
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h
index 00528b8a754d..2dca18532f2e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.h
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.h
@@ -86,16 +86,6 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
86 u32 *reg); 86 u32 *reg);
87 87
88/** 88/**
89 * rt2x00pci_write_tx_data - Initialize data for TX operation
90 * @entry: The entry where the frame is located
91 *
92 * This function will initialize the DMA and skb descriptor
93 * to prepare the entry for the actual TX operation.
94 */
95int rt2x00pci_write_tx_data(struct queue_entry *entry,
96 struct txentry_desc *txdesc);
97
98/**
99 * struct queue_entry_priv_pci: Per entry PCI specific information 89 * struct queue_entry_priv_pci: Per entry PCI specific information
100 * 90 *
101 * @desc: Pointer to device descriptor 91 * @desc: Pointer to device descriptor
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index f91637147116..b9cc253cf962 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -404,6 +404,46 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
404 rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate); 404 rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
405} 405}
406 406
407static int rt2x00queue_write_tx_data(struct queue_entry *entry,
408 struct txentry_desc *txdesc)
409{
410 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
411
412 /*
413 * This should not happen, we already checked the entry
414 * was ours. When the hardware disagrees there has been
415 * a queue corruption!
416 */
417 if (unlikely(rt2x00dev->ops->lib->get_entry_state &&
418 rt2x00dev->ops->lib->get_entry_state(entry))) {
419 ERROR(rt2x00dev,
420 "Corrupt queue %d, accessing entry which is not ours.\n"
421 "Please file bug report to %s.\n",
422 entry->queue->qid, DRV_PROJECT);
423 return -EINVAL;
424 }
425
426 /*
427 * Add the requested extra tx headroom in front of the skb.
428 */
429 skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom);
430 memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom);
431
432 /*
433 * Call the driver's write_tx_datadesc function, if it exists.
434 */
435 if (rt2x00dev->ops->lib->write_tx_datadesc)
436 rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
437
438 /*
439 * Map the skb to DMA.
440 */
441 if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
442 rt2x00queue_map_txskb(rt2x00dev, entry->skb);
443
444 return 0;
445}
446
407static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, 447static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
408 struct txentry_desc *txdesc) 448 struct txentry_desc *txdesc)
409{ 449{
@@ -515,8 +555,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
515 * call failed. Since we always return NETDEV_TX_OK to mac80211, 555 * call failed. Since we always return NETDEV_TX_OK to mac80211,
516 * this frame will simply be dropped. 556 * this frame will simply be dropped.
517 */ 557 */
518 if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry, 558 if (unlikely(rt2x00queue_write_tx_data(entry, &txdesc))) {
519 &txdesc))) {
520 clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); 559 clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
521 entry->skb = NULL; 560 entry->skb = NULL;
522 return -EIO; 561 return -EIO;
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 1c91812df173..f78ebb4d8cf1 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -207,27 +207,6 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
207 rt2x00lib_txdone(entry, &txdesc); 207 rt2x00lib_txdone(entry, &txdesc);
208} 208}
209 209
210int rt2x00usb_write_tx_data(struct queue_entry *entry,
211 struct txentry_desc *txdesc)
212{
213 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
214
215 /*
216 * Add the descriptor in front of the skb.
217 */
218 skb_push(entry->skb, entry->queue->desc_size);
219 memset(entry->skb->data, 0, entry->queue->desc_size);
220
221 /*
222 * Call the driver's write_tx_datadesc function, if it exists.
223 */
224 if (rt2x00dev->ops->lib->write_tx_datadesc)
225 rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
226
227 return 0;
228}
229EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data);
230
231static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry) 210static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
232{ 211{
233 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 212 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 255b81ef9530..2b7a1889e72f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -351,16 +351,6 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
351void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev); 351void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev);
352 352
353/** 353/**
354 * rt2x00usb_write_tx_data - Initialize URB for TX operation
355 * @entry: The entry where the frame is located
356 *
357 * This function will initialize the URB and skb descriptor
358 * to prepare the entry for the actual TX operation.
359 */
360int rt2x00usb_write_tx_data(struct queue_entry *entry,
361 struct txentry_desc *txdesc);
362
363/**
364 * struct queue_entry_priv_usb: Per entry USB specific information 354 * struct queue_entry_priv_usb: Per entry USB specific information
365 * 355 *
366 * @urb: Urb structure used for device communication. 356 * @urb: Urb structure used for device communication.
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 7ca383478eeb..cb6e20a1046e 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2800,7 +2800,6 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
2800 .reset_tuner = rt61pci_reset_tuner, 2800 .reset_tuner = rt61pci_reset_tuner,
2801 .link_tuner = rt61pci_link_tuner, 2801 .link_tuner = rt61pci_link_tuner,
2802 .write_tx_desc = rt61pci_write_tx_desc, 2802 .write_tx_desc = rt61pci_write_tx_desc,
2803 .write_tx_data = rt2x00pci_write_tx_data,
2804 .write_beacon = rt61pci_write_beacon, 2803 .write_beacon = rt61pci_write_beacon,
2805 .kick_tx_queue = rt61pci_kick_tx_queue, 2804 .kick_tx_queue = rt61pci_kick_tx_queue,
2806 .kill_tx_queue = rt61pci_kill_tx_queue, 2805 .kill_tx_queue = rt61pci_kill_tx_queue,
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index d06d90f003e7..286dd97e51d8 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2249,7 +2249,6 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
2249 .reset_tuner = rt73usb_reset_tuner, 2249 .reset_tuner = rt73usb_reset_tuner,
2250 .link_tuner = rt73usb_link_tuner, 2250 .link_tuner = rt73usb_link_tuner,
2251 .write_tx_desc = rt73usb_write_tx_desc, 2251 .write_tx_desc = rt73usb_write_tx_desc,
2252 .write_tx_data = rt2x00usb_write_tx_data,
2253 .write_beacon = rt73usb_write_beacon, 2252 .write_beacon = rt73usb_write_beacon,
2254 .get_tx_data_len = rt73usb_get_tx_data_len, 2253 .get_tx_data_len = rt73usb_get_tx_data_len,
2255 .kick_tx_queue = rt2x00usb_kick_tx_queue, 2254 .kick_tx_queue = rt2x00usb_kick_tx_queue,