ath9k: implement extended channel utilization statistics via survey
[oweals/openwrt.git] / package / mac80211 / patches / 525-ath9k_channel_count_check.patch
1 --- a/drivers/net/wireless/ath/ath9k/hw.h
2 +++ b/drivers/net/wireless/ath/ath9k/hw.h
3 @@ -61,6 +61,8 @@
4  
5  #define ATH9K_RSSI_BAD                 -128
6  
7 +#define ATH9K_NUM_CHANNELS     38
8 +
9  /* Register read/write primitives */
10  #define REG_WRITE(_ah, _reg, _val) \
11         ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
12 @@ -618,7 +620,7 @@ struct ath_hw {
13         struct ath9k_hw_version hw_version;
14         struct ath9k_ops_config config;
15         struct ath9k_hw_capabilities caps;
16 -       struct ath9k_channel channels[38];
17 +       struct ath9k_channel channels[ATH9K_NUM_CHANNELS];
18         struct ath9k_channel *curchan;
19  
20         union {
21 --- a/drivers/net/wireless/ath/ath9k/init.c
22 +++ b/drivers/net/wireless/ath/ath9k/init.c
23 @@ -482,6 +482,10 @@ static int ath9k_init_channels_rates(str
24  {
25         void *channels;
26  
27 +       BUILD_BUG_ON(ARRAY_SIZE(ath9k_2ghz_chantable) +
28 +                    ARRAY_SIZE(ath9k_5ghz_chantable) !=
29 +                    ATH9K_NUM_CHANNELS);
30 +
31         if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) {
32                 channels = kmemdup(ath9k_2ghz_chantable,
33                         sizeof(ath9k_2ghz_chantable), GFP_KERNEL);