firmware: qcom: scm: Generalize shared error map
authorAndy Gross <andy.gross@linaro.org>
Fri, 3 Jun 2016 23:25:24 +0000 (18:25 -0500)
committerAndy Gross <andy.gross@linaro.org>
Fri, 24 Jun 2016 18:33:59 +0000 (13:33 -0500)
This patch moves the qcom_scm_remap_error function to the include file
where can be used by both the 32 and 64 bit versions of the code.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Andy Gross <agross@codeaurora.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
drivers/firmware/qcom_scm-32.c
drivers/firmware/qcom_scm.h

index 5be6a123ac7023e2a2aa7e661d167751eb06bd6c..4388d13b437ac7c4a9dde479665c65c48c06b5ad 100644 (file)
@@ -168,23 +168,6 @@ static inline void *qcom_scm_get_response_buffer(const struct qcom_scm_response
        return (void *)rsp + le32_to_cpu(rsp->buf_offset);
 }
 
-static int qcom_scm_remap_error(int err)
-{
-       pr_err("qcom_scm_call failed with error code %d\n", err);
-       switch (err) {
-       case QCOM_SCM_ERROR:
-               return -EIO;
-       case QCOM_SCM_EINVAL_ADDR:
-       case QCOM_SCM_EINVAL_ARG:
-               return -EINVAL;
-       case QCOM_SCM_EOPNOTSUPP:
-               return -EOPNOTSUPP;
-       case QCOM_SCM_ENOMEM:
-               return -ENOMEM;
-       }
-       return -EINVAL;
-}
-
 static u32 smc(u32 cmd_addr)
 {
        int context_id;
index 2cce75c08b9989329f8e72a58b41675e5f0a575e..7dcc73381b7ae8787fe153308224e81f566c479c 100644 (file)
@@ -44,4 +44,20 @@ extern int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt,
 #define QCOM_SCM_ERROR         -1
 #define QCOM_SCM_INTERRUPTED   1
 
+static inline int qcom_scm_remap_error(int err)
+{
+       switch (err) {
+       case QCOM_SCM_ERROR:
+               return -EIO;
+       case QCOM_SCM_EINVAL_ADDR:
+       case QCOM_SCM_EINVAL_ARG:
+               return -EINVAL;
+       case QCOM_SCM_EOPNOTSUPP:
+               return -EOPNOTSUPP;
+       case QCOM_SCM_ENOMEM:
+               return -ENOMEM;
+       }
+       return -EINVAL;
+}
+
 #endif