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

Commit e419d62d authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by John W. Linville
Browse files

iwlagn: consolidate the API that sends host commands and move to transport



Now, there are only two functions to send a host command:
* send_cmd that receives a iwl_host_cmd
* send_cmd_pdu that builds the iwl_host_cmd itself and received flags

The flags CMD_ASYNC / CMD_SYNC / CMD_WANT_SKB are not changed by the API
functions.

Kill the unused flags CMD_SIZE_NORMAL / CMD_NO_SKB on the way.

Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 06f491ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
		return -EFAULT;
	}

	return iwl_send_cmd_sync(priv, &hcmd);
	return priv->trans.ops->send_cmd(priv, &hcmd);
}

static struct iwl_lib_ops iwl5000_lib = {
+1 −1
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
		return -EFAULT;
	}

	return iwl_send_cmd_sync(priv, &hcmd);
	return priv->trans.ops->send_cmd(priv, &hcmd);
}

static struct iwl_lib_ops iwl6000_lib = {
+4 −3
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)

	struct iwl_host_cmd hcmd = {
		.id = REPLY_PHY_CALIBRATION_CMD,
		.flags = CMD_SYNC,
	};

	for (i = 0; i < IWL_CALIB_MAX; i++) {
@@ -95,7 +96,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)
			hcmd.len[0] = priv->calib_results[i].buf_len;
			hcmd.data[0] = priv->calib_results[i].buf;
			hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
			ret = iwl_send_cmd_sync(priv, &hcmd);
			ret = priv->trans.ops->send_cmd(priv, &hcmd);
			if (ret) {
				IWL_ERR(priv, "Error %d iteration %d\n",
					ret, i);
@@ -481,7 +482,7 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
	memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
	       sizeof(u16)*HD_TABLE_SIZE);

	return iwl_send_cmd(priv, &cmd_out);
	return priv->trans.ops->send_cmd(priv, &cmd_out);
}

/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
@@ -545,7 +546,7 @@ static int iwl_enhance_sensitivity_write(struct iwl_priv *priv)
	       &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]),
	       sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES);

	return iwl_send_cmd(priv, &cmd_out);
	return priv->trans.ops->send_cmd(priv, &cmd_out);
}

void iwl_init_sensitivity(struct iwl_priv *priv)
+10 −6
Original line number Diff line number Diff line
@@ -45,7 +45,9 @@ int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant)

	if (IWL_UCODE_API(priv->ucode_ver) > 1) {
		IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant);
		return iwl_send_cmd_pdu(priv, TX_ANT_CONFIGURATION_CMD,
		return priv->trans.ops->send_cmd_pdu(priv,
					TX_ANT_CONFIGURATION_CMD,
					CMD_SYNC,
					sizeof(struct iwl_tx_ant_config_cmd),
					&tx_ant_cmd);
	} else {
@@ -115,8 +117,8 @@ static void iwlagn_gain_computation(struct iwl_priv *priv,
			priv->_agn.phy_calib_chain_noise_gain_cmd);
		cmd.delta_gain_1 = data->delta_gain_code[1];
		cmd.delta_gain_2 = data->delta_gain_code[2];
		iwl_send_cmd_pdu_async(priv, REPLY_PHY_CALIBRATION_CMD,
			sizeof(cmd), &cmd, NULL);
		priv->trans.ops->send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
			CMD_ASYNC, sizeof(cmd), &cmd);

		data->radio_write = 1;
		data->state = IWL_CHAIN_NOISE_CALIBRATED;
@@ -144,8 +146,9 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
		memset(&cmd, 0, sizeof(cmd));
		iwl_set_calib_hdr(&cmd.hdr,
			priv->_agn.phy_calib_chain_noise_reset_cmd);
		ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
					sizeof(cmd), &cmd);
		ret = priv->trans.ops->send_cmd_pdu(priv,
					REPLY_PHY_CALIBRATION_CMD,
					CMD_SYNC, sizeof(cmd), &cmd);
		if (ret)
			IWL_ERR(priv,
				"Could not send REPLY_PHY_CALIBRATION_CMD\n");
@@ -290,7 +293,8 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
	cmd.slots[0].width = cpu_to_le16(slot0);
	cmd.slots[1].width = cpu_to_le16(slot1);

	ret = iwl_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, sizeof(cmd), &cmd);
	ret = priv->trans.ops->send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, CMD_SYNC,
			sizeof(cmd), &cmd);
	if (ret)
		IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret);

+9 −8
Original line number Diff line number Diff line
@@ -540,8 +540,8 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
	else
		tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;

	return iwl_send_cmd_pdu(priv, tx_ant_cfg_cmd, sizeof(tx_power_cmd),
				&tx_power_cmd);
	return priv->trans.ops->send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC,
			sizeof(tx_power_cmd), &tx_power_cmd);
}

void iwlagn_temperature(struct iwl_priv *priv)
@@ -1063,6 +1063,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
	struct iwl_host_cmd cmd = {
		.id = REPLY_SCAN_CMD,
		.len = { sizeof(struct iwl_scan_cmd), },
		.flags = CMD_SYNC,
	};
	struct iwl_scan_cmd *scan;
	struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
@@ -1359,7 +1360,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
	if (ret)
		return ret;

	ret = iwl_send_cmd_sync(priv, &cmd);
	ret = priv->trans.ops->send_cmd(priv, &cmd);
	if (ret) {
		clear_bit(STATUS_SCAN_HW, &priv->status);
		iwlagn_set_pan_params(priv);
@@ -1465,7 +1466,7 @@ int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
		       flush_cmd.fifo_control);
	flush_cmd.flush_control = cpu_to_le16(flush_control);

	return iwl_send_cmd(priv, &cmd);
	return priv->trans.ops->send_cmd(priv, &cmd);
}

void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
@@ -1657,13 +1658,13 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
	if (priv->cfg->bt_params->bt_session_2) {
		memcpy(&bt_cmd_2000.basic, &basic,
			sizeof(basic));
		ret = iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
			sizeof(bt_cmd_2000), &bt_cmd_2000);
		ret = priv->trans.ops->send_cmd_pdu(priv, REPLY_BT_CONFIG,
			CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000);
	} else {
		memcpy(&bt_cmd_6000.basic, &basic,
			sizeof(basic));
		ret = iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
			sizeof(bt_cmd_6000), &bt_cmd_6000);
		ret = priv->trans.ops->send_cmd_pdu(priv, REPLY_BT_CONFIG,
			CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000);
	}
	if (ret)
		IWL_ERR(priv, "failed to send BT Coex Config\n");
Loading