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

Commit d6d4a58d authored by Kalle Valo's avatar Kalle Valo
Browse files

ath10k: separate result parameter in ath10k_bmi_execute()



It's just cleaner to have separate argument for the parameter and result. Also
fix returned error value if response length is invalid.

Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent b5a63788
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar,
	return 0;
}

int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result)
{
	struct bmi_cmd cmd;
	union bmi_resp resp;
@@ -184,7 +184,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
	int ret;

	ath10k_dbg(ATH10K_DBG_BMI, "bmi execute address 0x%x param 0x%x\n",
		   address, *param);
		   address, param);

	if (ar->bmi.done_sent) {
		ath10k_warn("command disallowed\n");
@@ -193,7 +193,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)

	cmd.id            = __cpu_to_le32(BMI_EXECUTE);
	cmd.execute.addr  = __cpu_to_le32(address);
	cmd.execute.param = __cpu_to_le32(*param);
	cmd.execute.param = __cpu_to_le32(param);

	ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, &resp, &resplen);
	if (ret) {
@@ -204,10 +204,13 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
	if (resplen < sizeof(resp.execute)) {
		ath10k_warn("invalid execute response length (%d)\n",
			    resplen);
		return ret;
		return -EIO;
	}

	*param = __le32_to_cpu(resp.execute.result);
	*result = __le32_to_cpu(resp.execute.result);

	ath10k_dbg(ATH10K_DBG_BMI, "bmi execute result 0x%x\n", *result);

	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
		ret;							\
	})

int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param);
int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result);
int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address);
int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length);
int ath10k_bmi_fast_download(struct ath10k *ar, u32 address,
+2 −4
Original line number Diff line number Diff line
@@ -249,8 +249,7 @@ static int ath10k_download_board_data(struct ath10k *ar)

static int ath10k_download_and_run_otp(struct ath10k *ar)
{
	u32 address = ar->hw_params.patch_load_addr;
	u32 exec_param;
	u32 result, address = ar->hw_params.patch_load_addr;
	int ret;

	/* OTP is optional */
@@ -264,8 +263,7 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
		goto exit;
	}

	exec_param = 0;
	ret = ath10k_bmi_execute(ar, address, &exec_param);
	ret = ath10k_bmi_execute(ar, address, 0, &result);
	if (ret) {
		ath10k_err("could not execute otp (%d)\n", ret);
		goto exit;