Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@
 * @fw: the iwl_fw structure
 * @shrd: pointer to common shared structure
 * @op_mode: the running op_mode
 * @trans: transport layer
 * @cfg: configuration struct
 * @fw_index: firmware revision to try loading
 * @firmware_name: composite filename of ucode file to load
 * @request_firmware_complete: the firmware has been obtained from user space
@@ -89,6 +91,7 @@ struct iwl_drv {
	struct iwl_shared *shrd;
	struct iwl_op_mode *op_mode;
	struct iwl_trans *trans;
	const struct iwl_cfg *cfg;

	int fw_index;                   /* firmware we're trying 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);

static int iwl_request_firmware(struct iwl_drv *drv, bool first)
{
	const struct iwl_cfg *cfg = cfg(drv);
	const char *name_pre = cfg->fw_name_pre;
	const char *name_pre = drv->cfg->fw_name_pre;
	char tag[8];

	if (first) {
@@ -167,14 +169,14 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
		strcpy(tag, UCODE_EXPERIMENTAL_TAG);
	} else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) {
#endif
		drv->fw_index = cfg->ucode_api_max;
		drv->fw_index = drv->cfg->ucode_api_max;
		sprintf(tag, "%d", drv->fw_index);
	} else {
		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");
		return -ENOENT;
	}
@@ -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)
{
	struct iwl_drv *drv = context;
	const struct iwl_cfg *cfg = cfg(drv);
	struct iwl_fw *fw = &drv->fw;
	struct iwl_ucode_header *ucode;
	int err;
	struct iwl_firmware_pieces pieces;
	const unsigned int api_max = cfg->ucode_api_max;
	unsigned int api_ok = cfg->ucode_api_ok;
	const unsigned int api_min = cfg->ucode_api_min;
	const unsigned int api_max = drv->cfg->ucode_api_max;
	unsigned int api_ok = drv->cfg->ucode_api_ok;
	const unsigned int api_min = drv->cfg->ucode_api_min;
	u32 api_ver;
	int i;

@@ -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
	 * 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;

	/* 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)
		fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12;
	else
		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->inst_evtlog_ptr = pieces.inst_evtlog_ptr;
	if (pieces.inst_evtlog_size)
		fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12;
	else
		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;

	/*
@@ -859,7 +860,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
	release_firmware(ucode_raw);
	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)
		goto out_unbind;
@@ -899,6 +900,7 @@ struct iwl_drv *iwl_drv_start(struct iwl_shared *shrd,
	/* For printing only - temporary until we change the logger */
	drv->shrd = shrd;
	drv->trans = trans;
	drv->cfg = cfg;

	init_completion(&drv->request_firmware_complete);