aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Chou <fred.chou.nd@gmail.com>2014-12-26 03:19:18 -0500
committerKalle Valo <kvalo@codeaurora.org>2015-01-07 03:41:42 -0500
commitb9d305cc47407f6a615145ff69e89060e7def6c7 (patch)
tree13bc5a4f09cdfc27f5376f42c3dd1a7ec73af891
parentc20e7789be9f64ed6000e3d985bc7203781a671c (diff)
rt2x00: use helper to check capability/requirement
Use rt2x00_has_cap_flag macro to check rt2x00dev->cap_flags. Signed-off-by: Fred Chou <fred.chou.nd@gmail.com> Acked-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00firmware.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c18
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c8
6 files changed, 26 insertions, 26 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 1122dc44c9fd..48a2cad29477 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -240,7 +240,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
240 rt2x00dev->rf_channel = libconf.rf.channel; 240 rt2x00dev->rf_channel = libconf.rf.channel;
241 } 241 }
242 242
243 if (test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) && 243 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_PS_AUTOWAKE) &&
244 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS)) 244 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
245 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); 245 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
246 246
@@ -257,7 +257,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
257 rt2x00link_reset_tuner(rt2x00dev, false); 257 rt2x00link_reset_tuner(rt2x00dev, false);
258 258
259 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && 259 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) &&
260 test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) && 260 rt2x00_has_cap_flag(rt2x00dev, REQUIRE_PS_AUTOWAKE) &&
261 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) && 261 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) &&
262 (conf->flags & IEEE80211_CONF_PS)) { 262 (conf->flags & IEEE80211_CONF_PS)) {
263 beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon; 263 beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon;
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 9967a1d9f0ec..5639ed816813 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -351,7 +351,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
351 /* 351 /*
352 * Remove L2 padding which was added during 352 * Remove L2 padding which was added during
353 */ 353 */
354 if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags)) 354 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
355 rt2x00queue_remove_l2pad(entry->skb, header_length); 355 rt2x00queue_remove_l2pad(entry->skb, header_length);
356 356
357 /* 357 /*
@@ -460,7 +460,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
460 * send the status report back. 460 * send the status report back.
461 */ 461 */
462 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) { 462 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) {
463 if (test_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags)) 463 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_TASKLET_CONTEXT))
464 ieee80211_tx_status(rt2x00dev->hw, entry->skb); 464 ieee80211_tx_status(rt2x00dev->hw, entry->skb);
465 else 465 else
466 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); 466 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
@@ -1056,9 +1056,9 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
1056 /* 1056 /*
1057 * Take TX headroom required for alignment into account. 1057 * Take TX headroom required for alignment into account.
1058 */ 1058 */
1059 if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags)) 1059 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
1060 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; 1060 rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE;
1061 else if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags)) 1061 else if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DMA))
1062 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; 1062 rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE;
1063 1063
1064 /* 1064 /*
@@ -1069,7 +1069,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
1069 /* 1069 /*
1070 * Allocate tx status FIFO for driver use. 1070 * Allocate tx status FIFO for driver use.
1071 */ 1071 */
1072 if (test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags)) { 1072 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_TXSTATUS_FIFO)) {
1073 /* 1073 /*
1074 * Allocate the txstatus fifo. In the worst case the tx 1074 * Allocate the txstatus fifo. In the worst case the tx
1075 * status fifo has to hold the tx status of all entries 1075 * status fifo has to hold the tx status of all entries
@@ -1131,7 +1131,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev)
1131 /* 1131 /*
1132 * Stop rfkill polling. 1132 * Stop rfkill polling.
1133 */ 1133 */
1134 if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1134 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL))
1135 rt2x00rfkill_unregister(rt2x00dev); 1135 rt2x00rfkill_unregister(rt2x00dev);
1136 1136
1137 /* 1137 /*
@@ -1173,7 +1173,7 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev)
1173 /* 1173 /*
1174 * Start rfkill polling. 1174 * Start rfkill polling.
1175 */ 1175 */
1176 if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1176 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL))
1177 rt2x00rfkill_register(rt2x00dev); 1177 rt2x00rfkill_register(rt2x00dev);
1178 1178
1179 return 0; 1179 return 0;
@@ -1389,7 +1389,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1389 /* 1389 /*
1390 * Start rfkill polling. 1390 * Start rfkill polling.
1391 */ 1391 */
1392 if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1392 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL))
1393 rt2x00rfkill_register(rt2x00dev); 1393 rt2x00rfkill_register(rt2x00dev);
1394 1394
1395 return 0; 1395 return 0;
@@ -1408,7 +1408,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1408 /* 1408 /*
1409 * Stop rfkill polling. 1409 * Stop rfkill polling.
1410 */ 1410 */
1411 if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) 1411 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DELAYED_RFKILL))
1412 rt2x00rfkill_unregister(rt2x00dev); 1412 rt2x00rfkill_unregister(rt2x00dev);
1413 1413
1414 /* 1414 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00firmware.c b/drivers/net/wireless/rt2x00/rt2x00firmware.c
index fbae2799e3ee..5813300f68a2 100644
--- a/drivers/net/wireless/rt2x00/rt2x00firmware.c
+++ b/drivers/net/wireless/rt2x00/rt2x00firmware.c
@@ -96,7 +96,7 @@ int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev)
96{ 96{
97 int retval; 97 int retval;
98 98
99 if (!test_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags)) 99 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_FIRMWARE))
100 return 0; 100 return 0;
101 101
102 if (!rt2x00dev->fw) { 102 if (!rt2x00dev->fw) {
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index cb40245a0695..300876df056f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -119,7 +119,7 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
119 * Use the ATIM queue if appropriate and present. 119 * Use the ATIM queue if appropriate and present.
120 */ 120 */
121 if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM && 121 if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM &&
122 test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags)) 122 rt2x00_has_cap_flag(rt2x00dev, REQUIRE_ATIM_QUEUE))
123 qid = QID_ATIM; 123 qid = QID_ATIM;
124 124
125 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); 125 queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 66ff36447b94..68b620b2462f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -85,7 +85,7 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp)
85 memset(skbdesc, 0, sizeof(*skbdesc)); 85 memset(skbdesc, 0, sizeof(*skbdesc));
86 skbdesc->entry = entry; 86 skbdesc->entry = entry;
87 87
88 if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags)) { 88 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DMA)) {
89 dma_addr_t skb_dma; 89 dma_addr_t skb_dma;
90 90
91 skb_dma = dma_map_single(rt2x00dev->dev, skb->data, skb->len, 91 skb_dma = dma_map_single(rt2x00dev->dev, skb->data, skb->len,
@@ -198,7 +198,7 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev,
198 198
199 __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); 199 __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
200 200
201 if (!test_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags)) { 201 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_SW_SEQNO)) {
202 /* 202 /*
203 * rt2800 has a H/W (or F/W) bug, device incorrectly increase 203 * rt2800 has a H/W (or F/W) bug, device incorrectly increase
204 * seqno on retransmited data (non-QOS) frames. To workaround 204 * seqno on retransmited data (non-QOS) frames. To workaround
@@ -484,7 +484,7 @@ static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
484 rt2x00crypto_create_tx_descriptor(rt2x00dev, skb, txdesc); 484 rt2x00crypto_create_tx_descriptor(rt2x00dev, skb, txdesc);
485 rt2x00queue_create_tx_descriptor_seq(rt2x00dev, skb, txdesc); 485 rt2x00queue_create_tx_descriptor_seq(rt2x00dev, skb, txdesc);
486 486
487 if (test_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags)) 487 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_HT_TX_DESC))
488 rt2x00queue_create_tx_descriptor_ht(rt2x00dev, skb, txdesc, 488 rt2x00queue_create_tx_descriptor_ht(rt2x00dev, skb, txdesc,
489 sta, hwrate); 489 sta, hwrate);
490 else 490 else
@@ -526,7 +526,7 @@ static int rt2x00queue_write_tx_data(struct queue_entry *entry,
526 /* 526 /*
527 * Map the skb to DMA. 527 * Map the skb to DMA.
528 */ 528 */
529 if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags) && 529 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_DMA) &&
530 rt2x00queue_map_txskb(entry)) 530 rt2x00queue_map_txskb(entry))
531 return -ENOMEM; 531 return -ENOMEM;
532 532
@@ -646,7 +646,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
646 */ 646 */
647 if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) && 647 if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) &&
648 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) { 648 !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) {
649 if (test_bit(REQUIRE_COPY_IV, &queue->rt2x00dev->cap_flags)) 649 if (rt2x00_has_cap_flag(queue->rt2x00dev, REQUIRE_COPY_IV))
650 rt2x00crypto_tx_copy_iv(skb, &txdesc); 650 rt2x00crypto_tx_copy_iv(skb, &txdesc);
651 else 651 else
652 rt2x00crypto_tx_remove_iv(skb, &txdesc); 652 rt2x00crypto_tx_remove_iv(skb, &txdesc);
@@ -660,9 +660,9 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
660 * PCI and USB devices, while header alignment only is valid 660 * PCI and USB devices, while header alignment only is valid
661 * for PCI devices. 661 * for PCI devices.
662 */ 662 */
663 if (test_bit(REQUIRE_L2PAD, &queue->rt2x00dev->cap_flags)) 663 if (rt2x00_has_cap_flag(queue->rt2x00dev, REQUIRE_L2PAD))
664 rt2x00queue_insert_l2pad(skb, txdesc.header_length); 664 rt2x00queue_insert_l2pad(skb, txdesc.header_length);
665 else if (test_bit(REQUIRE_DMA, &queue->rt2x00dev->cap_flags)) 665 else if (rt2x00_has_cap_flag(queue->rt2x00dev, REQUIRE_DMA))
666 rt2x00queue_align_frame(skb); 666 rt2x00queue_align_frame(skb);
667 667
668 /* 668 /*
@@ -1178,7 +1178,7 @@ int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev)
1178 if (status) 1178 if (status)
1179 goto exit; 1179 goto exit;
1180 1180
1181 if (test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags)) { 1181 if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_ATIM_QUEUE)) {
1182 status = rt2x00queue_alloc_entries(rt2x00dev->atim); 1182 status = rt2x00queue_alloc_entries(rt2x00dev->atim);
1183 if (status) 1183 if (status)
1184 goto exit; 1184 goto exit;
@@ -1234,7 +1234,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev)
1234 struct data_queue *queue; 1234 struct data_queue *queue;
1235 enum data_queue_qid qid; 1235 enum data_queue_qid qid;
1236 unsigned int req_atim = 1236 unsigned int req_atim =
1237 !!test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags); 1237 rt2x00_has_cap_flag(rt2x00dev, REQUIRE_ATIM_QUEUE);
1238 1238
1239 /* 1239 /*
1240 * We need the following queues: 1240 * We need the following queues:
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 892270dd3e7b..7627af6098eb 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -274,7 +274,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
274 * Schedule the delayed work for reading the TX status 274 * Schedule the delayed work for reading the TX status
275 * from the device. 275 * from the device.
276 */ 276 */
277 if (!test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags) || 277 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_TXSTATUS_FIFO) ||
278 !kfifo_is_empty(&rt2x00dev->txstatus_fifo)) 278 !kfifo_is_empty(&rt2x00dev->txstatus_fifo))
279 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); 279 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
280} 280}
@@ -456,7 +456,7 @@ static bool rt2x00usb_flush_entry(struct queue_entry *entry, void *data)
456 * Kill guardian urb (if required by driver). 456 * Kill guardian urb (if required by driver).
457 */ 457 */
458 if ((entry->queue->qid == QID_BEACON) && 458 if ((entry->queue->qid == QID_BEACON) &&
459 (test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags))) 459 (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_BEACON_GUARD)))
460 usb_kill_urb(bcn_priv->guardian_urb); 460 usb_kill_urb(bcn_priv->guardian_urb);
461 461
462 return false; 462 return false;
@@ -655,7 +655,7 @@ static int rt2x00usb_alloc_entries(struct data_queue *queue)
655 * then we are done. 655 * then we are done.
656 */ 656 */
657 if (queue->qid != QID_BEACON || 657 if (queue->qid != QID_BEACON ||
658 !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)) 658 !rt2x00_has_cap_flag(rt2x00dev, REQUIRE_BEACON_GUARD))
659 return 0; 659 return 0;
660 660
661 for (i = 0; i < queue->limit; i++) { 661 for (i = 0; i < queue->limit; i++) {
@@ -690,7 +690,7 @@ static void rt2x00usb_free_entries(struct data_queue *queue)
690 * then we are done. 690 * then we are done.
691 */ 691 */
692 if (queue->qid != QID_BEACON || 692 if (queue->qid != QID_BEACON ||
693 !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)) 693 !rt2x00_has_cap_flag(rt2x00dev, REQUIRE_BEACON_GUARD))
694 return; 694 return;
695 695
696 for (i = 0; i < queue->limit; i++) { 696 for (i = 0; i < queue->limit; i++) {