aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-09-21 05:03:50 -0400
committerLuca Coelho <luciano.coelho@intel.com>2017-10-06 06:59:44 -0400
commitd8c73e455d7b973d1346bb5632b4a41819b090c9 (patch)
tree2e03e9966db2d14d6c49efa98bf86db98f02b947 /drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
parent1442a9a9f2e441b15393c2d89286303b103a57e8 (diff)
iwlwifi: nvm-parse: unify channel flags printing
The current channel flags printing is very strange and messy, in LAR we sometimes print the channel number and sometimes the frequency, in both we print a calculated value (whether ad-hoc is supported or not) etc. Unify all this to * print the channel number, not the frequency * remove the band print (2.4/5.2 GHz, it's obvious) * remove the calculated Ad-Hoc print Doing all of this also gets the length of the string to a max of 101 characters, which is below the max of 110 for tracing, and thus avoids the warning that came up on certain channels with certain flag combinations. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c98
1 files changed, 39 insertions, 59 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index 3014beef4873..35638404c24e 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -206,8 +206,36 @@ enum iwl_nvm_channel_flags {
206 NVM_CHANNEL_DC_HIGH = BIT(12), 206 NVM_CHANNEL_DC_HIGH = BIT(12),
207}; 207};
208 208
209static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,
210 int chan, u16 flags)
211{
209#define CHECK_AND_PRINT_I(x) \ 212#define CHECK_AND_PRINT_I(x) \
210 ((ch_flags & NVM_CHANNEL_##x) ? # x " " : "") 213 ((flags & NVM_CHANNEL_##x) ? " " #x : "")
214
215 if (!(flags & NVM_CHANNEL_VALID)) {
216 IWL_DEBUG_DEV(dev, level, "Ch. %d: 0x%x: No traffic\n",
217 chan, flags);
218 return;
219 }
220
221 /* Note: already can print up to 101 characters, 110 is the limit! */
222 IWL_DEBUG_DEV(dev, level,
223 "Ch. %d: 0x%x:%s%s%s%s%s%s%s%s%s%s%s%s\n",
224 chan, flags,
225 CHECK_AND_PRINT_I(VALID),
226 CHECK_AND_PRINT_I(IBSS),
227 CHECK_AND_PRINT_I(ACTIVE),
228 CHECK_AND_PRINT_I(RADAR),
229 CHECK_AND_PRINT_I(INDOOR_ONLY),
230 CHECK_AND_PRINT_I(GO_CONCURRENT),
231 CHECK_AND_PRINT_I(UNIFORM),
232 CHECK_AND_PRINT_I(20MHZ),
233 CHECK_AND_PRINT_I(40MHZ),
234 CHECK_AND_PRINT_I(80MHZ),
235 CHECK_AND_PRINT_I(160MHZ),
236 CHECK_AND_PRINT_I(DC_HIGH));
237#undef CHECK_AND_PRINT_I
238}
211 239
212static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz, 240static u32 iwl_get_channel_flags(u8 ch_num, int ch_idx, bool is_5ghz,
213 u16 nvm_flags, const struct iwl_cfg *cfg) 241 u16 nvm_flags, const struct iwl_cfg *cfg)
@@ -302,12 +330,8 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
302 * supported, hence we still want to add them to 330 * supported, hence we still want to add them to
303 * the list of supported channels to cfg80211. 331 * the list of supported channels to cfg80211.
304 */ 332 */
305 IWL_DEBUG_EEPROM(dev, 333 iwl_nvm_print_channel_flags(dev, IWL_DL_EEPROM,
306 "Ch. %d Flags %x [%sGHz] - No traffic\n", 334 nvm_chan[ch_idx], ch_flags);
307 nvm_chan[ch_idx],
308 ch_flags,
309 (ch_idx >= num_2ghz_channels) ?
310 "5.2" : "2.4");
311 continue; 335 continue;
312 } 336 }
313 337
@@ -337,27 +361,10 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
337 else 361 else
338 channel->flags = 0; 362 channel->flags = 0;
339 363
340 IWL_DEBUG_EEPROM(dev, 364 iwl_nvm_print_channel_flags(dev, IWL_DL_EEPROM,
341 "Ch. %d [%sGHz] flags 0x%x %s%s%s%s%s%s%s%s%s%s%s%s(%ddBm): Ad-Hoc %ssupported\n", 365 channel->hw_value, ch_flags);
342 channel->hw_value, 366 IWL_DEBUG_EEPROM(dev, "Ch. %d: %ddBm\n",
343 is_5ghz ? "5.2" : "2.4", 367 channel->hw_value, channel->max_power);
344 ch_flags,
345 CHECK_AND_PRINT_I(VALID),
346 CHECK_AND_PRINT_I(IBSS),
347 CHECK_AND_PRINT_I(ACTIVE),
348 CHECK_AND_PRINT_I(RADAR),
349 CHECK_AND_PRINT_I(INDOOR_ONLY),
350 CHECK_AND_PRINT_I(GO_CONCURRENT),
351 CHECK_AND_PRINT_I(UNIFORM),
352 CHECK_AND_PRINT_I(20MHZ),
353 CHECK_AND_PRINT_I(40MHZ),
354 CHECK_AND_PRINT_I(80MHZ),
355 CHECK_AND_PRINT_I(160MHZ),
356 CHECK_AND_PRINT_I(DC_HIGH),
357 channel->max_power,
358 ((ch_flags & NVM_CHANNEL_IBSS) &&
359 !(ch_flags & NVM_CHANNEL_RADAR))
360 ? "" : "not ");
361 } 368 }
362 369
363 return n_channels; 370 return n_channels;
@@ -873,12 +880,8 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
873 new_rule = false; 880 new_rule = false;
874 881
875 if (!(ch_flags & NVM_CHANNEL_VALID)) { 882 if (!(ch_flags & NVM_CHANNEL_VALID)) {
876 IWL_DEBUG_DEV(dev, IWL_DL_LAR, 883 iwl_nvm_print_channel_flags(dev, IWL_DL_LAR,
877 "Ch. %d Flags %x [%sGHz] - No traffic\n", 884 nvm_chan[ch_idx], ch_flags);
878 nvm_chan[ch_idx],
879 ch_flags,
880 (ch_idx >= NUM_2GHZ_CHANNELS) ?
881 "5.2" : "2.4");
882 continue; 885 continue;
883 } 886 }
884 887
@@ -914,31 +917,8 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
914 prev_center_freq = center_freq; 917 prev_center_freq = center_freq;
915 prev_reg_rule_flags = reg_rule_flags; 918 prev_reg_rule_flags = reg_rule_flags;
916 919
917 IWL_DEBUG_DEV(dev, IWL_DL_LAR, 920 iwl_nvm_print_channel_flags(dev, IWL_DL_LAR,
918 "Ch. %d [%sGHz] %s%s%s%s%s%s%s%s%s%s%s%s(0x%02x)\n", 921 nvm_chan[ch_idx], ch_flags);
919 center_freq,
920 band == NL80211_BAND_5GHZ ? "5.2" : "2.4",
921 CHECK_AND_PRINT_I(VALID),
922 CHECK_AND_PRINT_I(IBSS),
923 CHECK_AND_PRINT_I(ACTIVE),
924 CHECK_AND_PRINT_I(RADAR),
925 CHECK_AND_PRINT_I(INDOOR_ONLY),
926 CHECK_AND_PRINT_I(GO_CONCURRENT),
927 CHECK_AND_PRINT_I(UNIFORM),
928 CHECK_AND_PRINT_I(20MHZ),
929 CHECK_AND_PRINT_I(40MHZ),
930 CHECK_AND_PRINT_I(80MHZ),
931 CHECK_AND_PRINT_I(160MHZ),
932 CHECK_AND_PRINT_I(DC_HIGH),
933 ch_flags);
934 IWL_DEBUG_DEV(dev, IWL_DL_LAR,
935 "Ch. %d [%sGHz] reg_flags 0x%x: %s\n",
936 center_freq,
937 band == NL80211_BAND_5GHZ ? "5.2" : "2.4",
938 reg_rule_flags,
939 ((ch_flags & NVM_CHANNEL_ACTIVE) &&
940 !(ch_flags & NVM_CHANNEL_RADAR))
941 ? "Ad-Hoc" : "");
942 } 922 }
943 923
944 regd->n_reg_rules = valid_rules; 924 regd->n_reg_rules = valid_rules;