aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2010-06-02 06:23:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-04 16:00:39 -0400
commit61389f3ed49968746327aef0454b2f27e88e0f8d (patch)
treee4ec07bf3210330eb292890b0a09c7b0d5460679 /drivers/net/wireless/ath/ath9k
parentb176286276f85e10e8ab3342730c5e39e1ce460b (diff)
ath9k_common: Move count_streams to common module
This can be used by ath9k_htc. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c13
-rw-r--r--drivers/net/wireless/ath/ath9k/common.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c16
3 files changed, 16 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index 03590f048fb..16e2849f644 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -397,6 +397,19 @@ void ath9k_cmn_key_delete(struct ath_common *common,
397} 397}
398EXPORT_SYMBOL(ath9k_cmn_key_delete); 398EXPORT_SYMBOL(ath9k_cmn_key_delete);
399 399
400int ath9k_cmn_count_streams(unsigned int chainmask, int max)
401{
402 int streams = 0;
403
404 do {
405 if (++streams == max)
406 break;
407 } while ((chainmask = chainmask & (chainmask - 1)));
408
409 return streams;
410}
411EXPORT_SYMBOL(ath9k_cmn_count_streams);
412
400static int __init ath9k_cmn_init(void) 413static int __init ath9k_cmn_init(void)
401{ 414{
402 return 0; 415 return 0;
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h
index 283cca84832..97809d39c73 100644
--- a/drivers/net/wireless/ath/ath9k/common.h
+++ b/drivers/net/wireless/ath/ath9k/common.h
@@ -64,3 +64,4 @@ int ath9k_cmn_key_config(struct ath_common *common,
64 struct ieee80211_key_conf *key); 64 struct ieee80211_key_conf *key);
65void ath9k_cmn_key_delete(struct ath_common *common, 65void ath9k_cmn_key_delete(struct ath_common *common,
66 struct ieee80211_key_conf *key); 66 struct ieee80211_key_conf *key);
67int ath9k_cmn_count_streams(unsigned int chainmask, int max);
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index f388dcc8e46..18d76ede859 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -175,18 +175,6 @@ static const struct ath_ops ath9k_common_ops = {
175 .write = ath9k_iowrite32, 175 .write = ath9k_iowrite32,
176}; 176};
177 177
178static int count_streams(unsigned int chainmask, int max)
179{
180 int streams = 0;
181
182 do {
183 if (++streams == max)
184 break;
185 } while ((chainmask = chainmask & (chainmask - 1)));
186
187 return streams;
188}
189
190/**************************/ 178/**************************/
191/* Initialization */ 179/* Initialization */
192/**************************/ 180/**************************/
@@ -227,8 +215,8 @@ static void setup_ht_cap(struct ath_softc *sc,
227 215
228 /* set up supported mcs set */ 216 /* set up supported mcs set */
229 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); 217 memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
230 tx_streams = count_streams(common->tx_chainmask, max_streams); 218 tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, max_streams);
231 rx_streams = count_streams(common->rx_chainmask, max_streams); 219 rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, max_streams);
232 220
233 ath_print(common, ATH_DBG_CONFIG, 221 ath_print(common, ATH_DBG_CONFIG,
234 "TX streams %d, RX streams: %d\n", 222 "TX streams %d, RX streams: %d\n",