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

Commit 61c4ae5d authored by Neeraj Upadhyay's avatar Neeraj Upadhyay Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: scm: Remap scm busy error codes to -EBUSY



Current code do not remap SCM busy error codes and return
the same code to the client. This causes confusion as
client drivers check the return value against linux
error codes for other failure cases and also can't
access the internal SCM busy error code definitions.
Fix this by remapping SCM busy error codes to -EBUSY.

Change-Id: Ic3dcdf415b2edc85714fcb0c821ec302fcd967d3
Signed-off-by: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
parent 0c094f0f
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -185,9 +185,8 @@ static int scm_remap_error(int err)
	case SCM_ENOMEM:
		return -ENOMEM;
	case SCM_EBUSY:
		return SCM_EBUSY;
	case SCM_V2_EBUSY:
		return SCM_V2_EBUSY;
		return -EBUSY;
	}
	return -EINVAL;
}
@@ -338,13 +337,13 @@ static int _scm_call_retry(u32 svc_id, u32 cmd_id, const void *cmd_buf,
	do {
		ret = scm_call_common(svc_id, cmd_id, cmd_buf, cmd_len,
					resp_buf, resp_len, cmd, len);
		if (ret == SCM_EBUSY)
		if (ret == -EBUSY)
			msleep(SCM_EBUSY_WAIT_MS);
		if (retry_count == 33)
			pr_warn("scm: secure world has been busy for 1 second!\n");
	} while (ret == SCM_EBUSY && (retry_count++ < SCM_EBUSY_MAX_RETRY));
	} while (ret == -EBUSY && (retry_count++ < SCM_EBUSY_MAX_RETRY));

	if (ret == SCM_EBUSY)
	if (ret == -EBUSY)
		pr_err("scm: secure world busy (rc = SCM_EBUSY)\n");

	return ret;
@@ -799,7 +798,7 @@ int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,

	ret = scm_call_common(svc_id, cmd_id, cmd_buf, cmd_len, resp_buf,
				resp_len, cmd, len);
	if (unlikely(ret == SCM_EBUSY))
	if (unlikely(ret == -EBUSY))
		ret = _scm_call_retry(svc_id, cmd_id, cmd_buf, cmd_len,
				      resp_buf, resp_len, cmd, PAGE_ALIGN(len));
	kfree(cmd);