aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 72d0818cfc98..69b5b1a05998 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -79,6 +79,8 @@
79 * @fw: the iwl_fw structure 79 * @fw: the iwl_fw structure
80 * @shrd: pointer to common shared structure 80 * @shrd: pointer to common shared structure
81 * @op_mode: the running op_mode 81 * @op_mode: the running op_mode
82 * @trans: transport layer
83 * @cfg: configuration struct
82 * @fw_index: firmware revision to try loading 84 * @fw_index: firmware revision to try loading
83 * @firmware_name: composite filename of ucode file to load 85 * @firmware_name: composite filename of ucode file to load
84 * @request_firmware_complete: the firmware has been obtained from user space 86 * @request_firmware_complete: the firmware has been obtained from user space
@@ -89,6 +91,7 @@ struct iwl_drv {
89 struct iwl_shared *shrd; 91 struct iwl_shared *shrd;
90 struct iwl_op_mode *op_mode; 92 struct iwl_op_mode *op_mode;
91 struct iwl_trans *trans; 93 struct iwl_trans *trans;
94 const struct iwl_cfg *cfg;
92 95
93 int fw_index; /* firmware we're trying to load */ 96 int fw_index; /* firmware we're trying to load */
94 char firmware_name[25]; /* name of firmware file to load */ 97 char firmware_name[25]; /* name of firmware file to load */
@@ -157,8 +160,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
157 160
158static int iwl_request_firmware(struct iwl_drv *drv, bool first) 161static int iwl_request_firmware(struct iwl_drv *drv, bool first)
159{ 162{
160 const struct iwl_cfg *cfg = cfg(drv); 163 const char *name_pre = drv->cfg->fw_name_pre;
161 const char *name_pre = cfg->fw_name_pre;
162 char tag[8]; 164 char tag[8];
163 165
164 if (first) { 166 if (first) {
@@ -167,14 +169,14 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
167 strcpy(tag, UCODE_EXPERIMENTAL_TAG); 169 strcpy(tag, UCODE_EXPERIMENTAL_TAG);
168 } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) { 170 } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) {
169#endif 171#endif
170 drv->fw_index = cfg->ucode_api_max; 172 drv->fw_index = drv->cfg->ucode_api_max;
171 sprintf(tag, "%d", drv->fw_index); 173 sprintf(tag, "%d", drv->fw_index);
172 } else { 174 } else {
173 drv->fw_index--; 175 drv->fw_index--;
174 sprintf(tag, "%d", drv->fw_index); 176 sprintf(tag, "%d", drv->fw_index);
175 } 177 }
176 178
177 if (drv->fw_index < cfg->ucode_api_min) { 179 if (drv->fw_index < drv->cfg->ucode_api_min) {
178 IWL_ERR(drv, "no suitable firmware found!\n"); 180 IWL_ERR(drv, "no suitable firmware found!\n");
179 return -ENOENT; 181 return -ENOENT;
180 } 182 }
@@ -726,14 +728,13 @@ static int validate_sec_sizes(struct iwl_drv *drv,
726static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) 728static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
727{ 729{
728 struct iwl_drv *drv = context; 730 struct iwl_drv *drv = context;
729 const struct iwl_cfg *cfg = cfg(drv);
730 struct iwl_fw *fw = &drv->fw; 731 struct iwl_fw *fw = &drv->fw;
731 struct iwl_ucode_header *ucode; 732 struct iwl_ucode_header *ucode;
732 int err; 733 int err;
733 struct iwl_firmware_pieces pieces; 734 struct iwl_firmware_pieces pieces;
734 const unsigned int api_max = cfg->ucode_api_max; 735 const unsigned int api_max = drv->cfg->ucode_api_max;
735 unsigned int api_ok = cfg->ucode_api_ok; 736 unsigned int api_ok = drv->cfg->ucode_api_ok;
736 const unsigned int api_min = cfg->ucode_api_min; 737 const unsigned int api_min = drv->cfg->ucode_api_min;
737 u32 api_ver; 738 u32 api_ver;
738 int i; 739 int i;
739 740
@@ -812,7 +813,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
812 * In mvm uCode there is no difference between data and instructions 813 * In mvm uCode there is no difference between data and instructions
813 * sections. 814 * sections.
814 */ 815 */
815 if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, cfg)) 816 if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, drv->cfg))
816 goto try_again; 817 goto try_again;
817 818
818 /* Allocate ucode buffers for card's bus-master loading ... */ 819 /* Allocate ucode buffers for card's bus-master loading ... */
@@ -836,14 +837,14 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
836 fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12; 837 fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12;
837 else 838 else
838 fw->init_evtlog_size = 839 fw->init_evtlog_size =
839 cfg->base_params->max_event_log_size; 840 drv->cfg->base_params->max_event_log_size;
840 fw->init_errlog_ptr = pieces.init_errlog_ptr; 841 fw->init_errlog_ptr = pieces.init_errlog_ptr;
841 fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr; 842 fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr;
842 if (pieces.inst_evtlog_size) 843 if (pieces.inst_evtlog_size)
843 fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12; 844 fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12;
844 else 845 else
845 fw->inst_evtlog_size = 846 fw->inst_evtlog_size =
846 cfg->base_params->max_event_log_size; 847 drv->cfg->base_params->max_event_log_size;
847 fw->inst_errlog_ptr = pieces.inst_errlog_ptr; 848 fw->inst_errlog_ptr = pieces.inst_errlog_ptr;
848 849
849 /* 850 /*
@@ -859,7 +860,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
859 release_firmware(ucode_raw); 860 release_firmware(ucode_raw);
860 complete(&drv->request_firmware_complete); 861 complete(&drv->request_firmware_complete);
861 862
862 drv->op_mode = iwl_dvm_ops.start(drv->trans, cfg, &drv->fw); 863 drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw);
863 864
864 if (!drv->op_mode) 865 if (!drv->op_mode)
865 goto out_unbind; 866 goto out_unbind;
@@ -899,6 +900,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd,
899 /* For printing only - temporary until we change the logger */ 900 /* For printing only - temporary until we change the logger */
900 drv->shrd = shrd; 901 drv->shrd = shrd;
901 drv->trans = trans; 902 drv->trans = trans;
903 drv->cfg = cfg;
902 904
903 init_completion(&drv->request_firmware_complete); 905 init_completion(&drv->request_firmware_complete);
904 906