Commit 68f360dc authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Wey-Yi Guy

iwlwifi: driver holds its pointer to the config

Instead of using the shared area that will be killed.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 2152268f
...@@ -79,6 +79,8 @@ ...@@ -79,6 +79,8 @@
* @fw: the iwl_fw structure * @fw: the iwl_fw structure
* @shrd: pointer to common shared structure * @shrd: pointer to common shared structure
* @op_mode: the running op_mode * @op_mode: the running op_mode
* @trans: transport layer
* @cfg: configuration struct
* @fw_index: firmware revision to try loading * @fw_index: firmware revision to try loading
* @firmware_name: composite filename of ucode file to load * @firmware_name: composite filename of ucode file to load
* @request_firmware_complete: the firmware has been obtained from user space * @request_firmware_complete: the firmware has been obtained from user space
...@@ -89,6 +91,7 @@ struct iwl_drv { ...@@ -89,6 +91,7 @@ struct iwl_drv {
struct iwl_shared *shrd; struct iwl_shared *shrd;
struct iwl_op_mode *op_mode; struct iwl_op_mode *op_mode;
struct iwl_trans *trans; struct iwl_trans *trans;
const struct iwl_cfg *cfg;
int fw_index; /* firmware we're trying to load */ int fw_index; /* firmware we're trying to load */
char firmware_name[25]; /* name of firmware file to load */ 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,8 +160,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
static int iwl_request_firmware(struct iwl_drv *drv, bool first) static int iwl_request_firmware(struct iwl_drv *drv, bool first)
{ {
const struct iwl_cfg *cfg = cfg(drv); const char *name_pre = drv->cfg->fw_name_pre;
const char *name_pre = cfg->fw_name_pre;
char tag[8]; char tag[8];
if (first) { if (first) {
...@@ -167,14 +169,14 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) ...@@ -167,14 +169,14 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
strcpy(tag, UCODE_EXPERIMENTAL_TAG); strcpy(tag, UCODE_EXPERIMENTAL_TAG);
} else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) { } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) {
#endif #endif
drv->fw_index = cfg->ucode_api_max; drv->fw_index = drv->cfg->ucode_api_max;
sprintf(tag, "%d", drv->fw_index); sprintf(tag, "%d", drv->fw_index);
} else { } else {
drv->fw_index--; drv->fw_index--;
sprintf(tag, "%d", drv->fw_index); sprintf(tag, "%d", drv->fw_index);
} }
if (drv->fw_index < cfg->ucode_api_min) { if (drv->fw_index < drv->cfg->ucode_api_min) {
IWL_ERR(drv, "no suitable firmware found!\n"); IWL_ERR(drv, "no suitable firmware found!\n");
return -ENOENT; return -ENOENT;
} }
...@@ -726,14 +728,13 @@ static int validate_sec_sizes(struct iwl_drv *drv, ...@@ -726,14 +728,13 @@ static int validate_sec_sizes(struct iwl_drv *drv,
static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
{ {
struct iwl_drv *drv = context; struct iwl_drv *drv = context;
const struct iwl_cfg *cfg = cfg(drv);
struct iwl_fw *fw = &drv->fw; struct iwl_fw *fw = &drv->fw;
struct iwl_ucode_header *ucode; struct iwl_ucode_header *ucode;
int err; int err;
struct iwl_firmware_pieces pieces; struct iwl_firmware_pieces pieces;
const unsigned int api_max = cfg->ucode_api_max; const unsigned int api_max = drv->cfg->ucode_api_max;
unsigned int api_ok = cfg->ucode_api_ok; unsigned int api_ok = drv->cfg->ucode_api_ok;
const unsigned int api_min = cfg->ucode_api_min; const unsigned int api_min = drv->cfg->ucode_api_min;
u32 api_ver; u32 api_ver;
int i; int i;
...@@ -812,7 +813,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -812,7 +813,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
* In mvm uCode there is no difference between data and instructions * In mvm uCode there is no difference between data and instructions
* sections. * sections.
*/ */
if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, cfg)) if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, drv->cfg))
goto try_again; goto try_again;
/* Allocate ucode buffers for card's bus-master loading ... */ /* 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,14 +837,14 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12; fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12;
else else
fw->init_evtlog_size = fw->init_evtlog_size =
cfg->base_params->max_event_log_size; drv->cfg->base_params->max_event_log_size;
fw->init_errlog_ptr = pieces.init_errlog_ptr; fw->init_errlog_ptr = pieces.init_errlog_ptr;
fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr; fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr;
if (pieces.inst_evtlog_size) if (pieces.inst_evtlog_size)
fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12; fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12;
else else
fw->inst_evtlog_size = fw->inst_evtlog_size =
cfg->base_params->max_event_log_size; drv->cfg->base_params->max_event_log_size;
fw->inst_errlog_ptr = pieces.inst_errlog_ptr; fw->inst_errlog_ptr = pieces.inst_errlog_ptr;
/* /*
...@@ -859,7 +860,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -859,7 +860,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
release_firmware(ucode_raw); release_firmware(ucode_raw);
complete(&drv->request_firmware_complete); complete(&drv->request_firmware_complete);
drv->op_mode = iwl_dvm_ops.start(drv->trans, cfg, &drv->fw); drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw);
if (!drv->op_mode) if (!drv->op_mode)
goto out_unbind; goto out_unbind;
...@@ -899,6 +900,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd, ...@@ -899,6 +900,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd,
/* For printing only - temporary until we change the logger */ /* For printing only - temporary until we change the logger */
drv->shrd = shrd; drv->shrd = shrd;
drv->trans = trans; drv->trans = trans;
drv->cfg = cfg;
init_completion(&drv->request_firmware_complete); init_completion(&drv->request_firmware_complete);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment