aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2010-06-16 06:12:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-16 14:59:03 -0400
commita66681935455bfbb95dfe42aa3182e3f5b1ff1b4 (patch)
treedf6977155ed9deaf0dc745b353af15475dfca6ce /drivers
parent02a78b42f84b61c689a22f4429d73f92a972bc83 (diff)
ath5k: use direct function calls for descriptors when possible
Use direct function calls for ath5k_hw_setup_rx_desc() and ath5k_hw_setup_mrr_tx_desc() instead of a function pointer which always pointed to the same function in the case of ath5k_hw_setup_rx_desc() and which is easily unified in the case of ath5k_hw_setup_mrr_tx_desc(). Also simplify the initialization function for the remaining function pointers. Signed-off-by: Bruno Randolf <br1@einfach.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h10
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c7
-rw-r--r--drivers/net/wireless/ath/ath5k/desc.c41
3 files changed, 20 insertions, 38 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 387c120108b5..ea6362a8988d 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1127,15 +1127,10 @@ struct ath5k_hw {
1127 /* 1127 /*
1128 * Function pointers 1128 * Function pointers
1129 */ 1129 */
1130 int (*ah_setup_rx_desc)(struct ath5k_hw *ah, struct ath5k_desc *desc,
1131 u32 size, unsigned int flags);
1132 int (*ah_setup_tx_desc)(struct ath5k_hw *, struct ath5k_desc *, 1130 int (*ah_setup_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
1133 unsigned int, unsigned int, int, enum ath5k_pkt_type, 1131 unsigned int, unsigned int, int, enum ath5k_pkt_type,
1134 unsigned int, unsigned int, unsigned int, unsigned int, 1132 unsigned int, unsigned int, unsigned int, unsigned int,
1135 unsigned int, unsigned int, unsigned int, unsigned int); 1133 unsigned int, unsigned int, unsigned int, unsigned int);
1136 int (*ah_setup_mrr_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
1137 unsigned int, unsigned int, unsigned int, unsigned int,
1138 unsigned int, unsigned int);
1139 int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *, 1134 int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
1140 struct ath5k_tx_status *); 1135 struct ath5k_tx_status *);
1141 int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *, 1136 int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *,
@@ -1236,6 +1231,11 @@ int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time);
1236 1231
1237/* Hardware Descriptor Functions */ 1232/* Hardware Descriptor Functions */
1238int ath5k_hw_init_desc_functions(struct ath5k_hw *ah); 1233int ath5k_hw_init_desc_functions(struct ath5k_hw *ah);
1234int ath5k_hw_setup_rx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
1235 u32 size, unsigned int flags);
1236int ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
1237 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2,
1238 u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3);
1239 1239
1240/* GPIO Functions */ 1240/* GPIO Functions */
1241void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state); 1241void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state);
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index a4482b53f685..20328bdd138b 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -769,7 +769,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
769 * return false w/o doing anything. MAC's that do 769 * return false w/o doing anything. MAC's that do
770 * support it will return true w/o doing anything. 770 * support it will return true w/o doing anything.
771 */ 771 */
772 ret = ah->ah_setup_mrr_tx_desc(ah, NULL, 0, 0, 0, 0, 0, 0); 772 ret = ath5k_hw_setup_mrr_tx_desc(ah, NULL, 0, 0, 0, 0, 0, 0);
773
773 if (ret < 0) 774 if (ret < 0)
774 goto err; 775 goto err;
775 if (ret > 0) 776 if (ret > 0)
@@ -1245,7 +1246,7 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1245 ds = bf->desc; 1246 ds = bf->desc;
1246 ds->ds_link = bf->daddr; /* link to self */ 1247 ds->ds_link = bf->daddr; /* link to self */
1247 ds->ds_data = bf->skbaddr; 1248 ds->ds_data = bf->skbaddr;
1248 ret = ah->ah_setup_rx_desc(ah, ds, ah->common.rx_bufsize, 0); 1249 ret = ath5k_hw_setup_rx_desc(ah, ds, ah->common.rx_bufsize, 0);
1249 if (ret) { 1250 if (ret) {
1250 ATH5K_ERR(sc, "%s: could not setup RX desc\n", __func__); 1251 ATH5K_ERR(sc, "%s: could not setup RX desc\n", __func__);
1251 return ret; 1252 return ret;
@@ -1354,7 +1355,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1354 mrr_tries[i] = info->control.rates[i + 1].count; 1355 mrr_tries[i] = info->control.rates[i + 1].count;
1355 } 1356 }
1356 1357
1357 ah->ah_setup_mrr_tx_desc(ah, ds, 1358 ath5k_hw_setup_mrr_tx_desc(ah, ds,
1358 mrr_rate[0], mrr_tries[0], 1359 mrr_rate[0], mrr_tries[0],
1359 mrr_rate[1], mrr_tries[1], 1360 mrr_rate[1], mrr_tries[1],
1360 mrr_rate[2], mrr_tries[2]); 1361 mrr_rate[2], mrr_tries[2]);
diff --git a/drivers/net/wireless/ath/ath5k/desc.c b/drivers/net/wireless/ath/ath5k/desc.c
index da5dbb63047f..b5a5d45f2e82 100644
--- a/drivers/net/wireless/ath/ath5k/desc.c
+++ b/drivers/net/wireless/ath/ath5k/desc.c
@@ -277,13 +277,17 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
277/* 277/*
278 * Initialize a 4-word multi rate retry tx control descriptor on 5212 278 * Initialize a 4-word multi rate retry tx control descriptor on 5212
279 */ 279 */
280static int 280int
281ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, 281ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
282 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2, 282 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2,
283 u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3) 283 u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3)
284{ 284{
285 struct ath5k_hw_4w_tx_ctl *tx_ctl; 285 struct ath5k_hw_4w_tx_ctl *tx_ctl;
286 286
287 /* no mrr support for cards older than 5212 */
288 if (ah->ah_version < AR5K_AR5212)
289 return 0;
290
287 /* 291 /*
288 * Rates can be 0 as long as the retry count is 0 too. 292 * Rates can be 0 as long as the retry count is 0 too.
289 * A zero rate and nonzero retry count will put the HW into a mode where 293 * A zero rate and nonzero retry count will put the HW into a mode where
@@ -323,15 +327,6 @@ ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
323 return 0; 327 return 0;
324} 328}
325 329
326/* no mrr support for cards older than 5212 */
327static int
328ath5k_hw_setup_no_mrr(struct ath5k_hw *ah, struct ath5k_desc *desc,
329 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2,
330 u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3)
331{
332 return 0;
333}
334
335/* 330/*
336 * Proccess the tx status descriptor on 5210/5211 331 * Proccess the tx status descriptor on 5210/5211
337 */ 332 */
@@ -480,8 +475,8 @@ static int ath5k_hw_proc_4word_tx_status(struct ath5k_hw *ah,
480/* 475/*
481 * Initialize an rx control descriptor 476 * Initialize an rx control descriptor
482 */ 477 */
483static int ath5k_hw_setup_rx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, 478int ath5k_hw_setup_rx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
484 u32 size, unsigned int flags) 479 u32 size, unsigned int flags)
485{ 480{
486 struct ath5k_hw_rx_ctl *rx_ctl; 481 struct ath5k_hw_rx_ctl *rx_ctl;
487 482
@@ -658,29 +653,15 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah,
658 */ 653 */
659int ath5k_hw_init_desc_functions(struct ath5k_hw *ah) 654int ath5k_hw_init_desc_functions(struct ath5k_hw *ah)
660{ 655{
661
662 if (ah->ah_version != AR5K_AR5210 &&
663 ah->ah_version != AR5K_AR5211 &&
664 ah->ah_version != AR5K_AR5212)
665 return -ENOTSUPP;
666
667 if (ah->ah_version == AR5K_AR5212) { 656 if (ah->ah_version == AR5K_AR5212) {
668 ah->ah_setup_rx_desc = ath5k_hw_setup_rx_desc;
669 ah->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc; 657 ah->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc;
670 ah->ah_setup_mrr_tx_desc = ath5k_hw_setup_mrr_tx_desc;
671 ah->ah_proc_tx_desc = ath5k_hw_proc_4word_tx_status; 658 ah->ah_proc_tx_desc = ath5k_hw_proc_4word_tx_status;
672 } else { 659 ah->ah_proc_rx_desc = ath5k_hw_proc_5212_rx_status;
673 ah->ah_setup_rx_desc = ath5k_hw_setup_rx_desc; 660 } else if (ah->ah_version <= AR5K_AR5211) {
674 ah->ah_setup_tx_desc = ath5k_hw_setup_2word_tx_desc; 661 ah->ah_setup_tx_desc = ath5k_hw_setup_2word_tx_desc;
675 ah->ah_setup_mrr_tx_desc = ath5k_hw_setup_no_mrr;
676 ah->ah_proc_tx_desc = ath5k_hw_proc_2word_tx_status; 662 ah->ah_proc_tx_desc = ath5k_hw_proc_2word_tx_status;
677 }
678
679 if (ah->ah_version == AR5K_AR5212)
680 ah->ah_proc_rx_desc = ath5k_hw_proc_5212_rx_status;
681 else if (ah->ah_version <= AR5K_AR5211)
682 ah->ah_proc_rx_desc = ath5k_hw_proc_5210_rx_status; 663 ah->ah_proc_rx_desc = ath5k_hw_proc_5210_rx_status;
683 664 } else
665 return -ENOTSUPP;
684 return 0; 666 return 0;
685} 667}
686