From 52dfa8f9dd3cc2c72bef8809b25b02f93f1ade44 Mon Sep 17 00:00:00 2001 From: Neeraj Upadhyay Date: Fri, 6 Oct 2017 19:52:10 +0530 Subject: [PATCH] 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: Neeraj Upadhyay --- drivers/soc/qcom/scm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/soc/qcom/scm.c b/drivers/soc/qcom/scm.c index 43e2e4d17648..c6bdcee8131e 100644 --- a/drivers/soc/qcom/scm.c +++ b/drivers/soc/qcom/scm.c @@ -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);