hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c
....@@ -7,7 +7,7 @@
77 *
88 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
99 * Copyright(c) 2015 Intel Mobile Communications GmbH
10
- * Copyright(c) 2018 Intel Corporation
10
+ * Copyright(c) 2018 - 2019 Intel Corporation
1111 *
1212 * This program is free software; you can redistribute it and/or modify
1313 * it under the terms of version 2 of the GNU General Public License as
....@@ -17,9 +17,6 @@
1717 * WITHOUT ANY WARRANTY; without even the implied warranty of
1818 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1919 * General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with this program;
2320 *
2421 * The full GNU General Public License is included in this distribution
2522 * in the file called COPYING.
....@@ -32,7 +29,7 @@
3229 *
3330 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
3431 * Copyright(c) 2015 Intel Mobile Communications GmbH
35
- * Copyright(c) 2018 Intel Corporation
32
+ * Copyright(c) 2018 - 2019 Intel Corporation
3633 * All rights reserved.
3734 *
3835 * Redistribution and use in source and binary forms, with or without
....@@ -731,12 +728,13 @@
731728 #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */
732729 #define MAX_BIT_RATE_20_MHZ 72 /* Mbps */
733730
734
-void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg,
731
+void iwl_init_ht_hw_capab(struct iwl_trans *trans,
735732 struct iwl_nvm_data *data,
736733 struct ieee80211_sta_ht_cap *ht_info,
737734 enum nl80211_band band,
738735 u8 tx_chains, u8 rx_chains)
739736 {
737
+ const struct iwl_cfg *cfg = trans->cfg;
740738 int max_bit_rate = 0;
741739
742740 tx_chains = hweight8(tx_chains);
....@@ -745,7 +743,9 @@
745743 else
746744 rx_chains = hweight8(rx_chains);
747745
748
- if (!(data->sku_cap_11n_enable) || !cfg->ht_params) {
746
+ if (!(data->sku_cap_11n_enable) ||
747
+ (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) ||
748
+ !cfg->ht_params) {
749749 ht_info->ht_supported = false;
750750 return;
751751 }
....@@ -766,7 +766,7 @@
766766 if (cfg->ht_params->ldpc)
767767 ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING;
768768
769
- if ((cfg->mq_rx_supported &&
769
+ if ((trans->trans_cfg->mq_rx_supported &&
770770 iwlwifi_mod_params.amsdu_size == IWL_AMSDU_DEF) ||
771771 iwlwifi_mod_params.amsdu_size >= IWL_AMSDU_8K)
772772 ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU;
....@@ -806,10 +806,11 @@
806806 }
807807 }
808808
809
-static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
809
+static void iwl_init_sbands(struct iwl_trans *trans, const struct iwl_cfg *cfg,
810810 struct iwl_nvm_data *data,
811811 const u8 *eeprom, size_t eeprom_size)
812812 {
813
+ struct device *dev = trans->dev;
813814 int n_channels = iwl_init_channel_map(dev, cfg, data,
814815 eeprom, eeprom_size);
815816 int n_used = 0;
....@@ -821,7 +822,7 @@
821822 sband->n_bitrates = N_RATES_24;
822823 n_used += iwl_init_sband_channels(data, sband, n_channels,
823824 NL80211_BAND_2GHZ);
824
- iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_2GHZ,
825
+ iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_2GHZ,
825826 data->valid_tx_ant, data->valid_rx_ant);
826827
827828 sband = &data->bands[NL80211_BAND_5GHZ];
....@@ -830,7 +831,7 @@
830831 sband->n_bitrates = N_RATES_52;
831832 n_used += iwl_init_sband_channels(data, sband, n_channels,
832833 NL80211_BAND_5GHZ);
833
- iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, NL80211_BAND_5GHZ,
834
+ iwl_init_ht_hw_capab(trans, data, &sband->ht_cap, NL80211_BAND_5GHZ,
834835 data->valid_tx_ant, data->valid_rx_ant);
835836
836837 if (n_channels != n_used)
....@@ -841,18 +842,18 @@
841842 /* EEPROM data functions */
842843
843844 struct iwl_nvm_data *
844
-iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg,
845
+iwl_parse_eeprom_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
845846 const u8 *eeprom, size_t eeprom_size)
846847 {
847848 struct iwl_nvm_data *data;
849
+ struct device *dev = trans->dev;
848850 const void *tmp;
849851 u16 radio_cfg, sku;
850852
851853 if (WARN_ON(!cfg || !cfg->eeprom_params))
852854 return NULL;
853855
854
- data = kzalloc(sizeof(*data) +
855
- sizeof(struct ieee80211_channel) * IWL_NUM_CHANNELS,
856
+ data = kzalloc(struct_size(data, channels, IWL_NUM_CHANNELS),
856857 GFP_KERNEL);
857858 if (!data)
858859 return NULL;
....@@ -920,7 +921,7 @@
920921 goto err_free;
921922 }
922923
923
- iwl_init_sbands(dev, cfg, data, eeprom, eeprom_size);
924
+ iwl_init_sbands(trans, cfg, data, eeprom, eeprom_size);
924925
925926 return data;
926927 err_free: