diff mbox series

[v2,03/18] firmware: qcom_scm-64: Make SMCCC macros less magical

Message ID 1573593774-12539-4-git-send-email-eberman@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series Restructure, improve target support for qcom_scm driver | expand

Commit Message

Elliot Berman Nov. 12, 2019, 9:22 p.m. UTC
Improve understandability of SMCCC macros as they are all functions of
how many arguments can be shoved in registers and how many SCM arguments
are supported.

Signed-off-by: Elliot Berman <eberman@codeaurora.org>
---
 drivers/firmware/qcom_scm-64.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stephen Boyd Nov. 15, 2019, 10:43 p.m. UTC | #1
Quoting Elliot Berman (2019-11-12 13:22:39)
> Improve understandability of SMCCC macros as they are all functions of
> how many arguments can be shoved in registers and how many SCM arguments
> are supported.

By reversing the logic to build up these defines based on the number of
register arguments instead of subtract them out of number of total
arguments? Might be worth mentioning that.

> 
> Signed-off-by: Elliot Berman <eberman@codeaurora.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

>  drivers/firmware/qcom_scm-64.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c
> index de337b3..badc245 100644
> --- a/drivers/firmware/qcom_scm-64.c
> +++ b/drivers/firmware/qcom_scm-64.c
> @@ -57,9 +57,9 @@ static DEFINE_MUTEX(qcom_scm_lock);
>  #define QCOM_SCM_EBUSY_MAX_RETRY 20
>  
>  #define SMCCC_FUNCNUM(s, c)    ((((s) & 0xFF) << 8) | ((c) & 0xFF))
> -#define SMCCC_N_EXT_ARGS 7
> -#define SMCCC_FIRST_EXT_IDX 3
> -#define SMCCC_N_REG_ARGS (MAX_QCOM_SCM_ARGS - SMCCC_N_EXT_ARGS + 1)
> +#define SMCCC_N_REG_ARGS       4
> +#define SMCCC_FIRST_EXT_IDX    (SMCCC_N_REG_ARGS - 1)
> +#define SMCCC_N_EXT_ARGS       (MAX_QCOM_SCM_ARGS - SMCCC_N_REG_ARGS + 1)
>  
>  static void __qcom_scm_call_do_quirk(const struct qcom_scm_desc *desc,
diff mbox series

Patch

diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c
index de337b3..badc245 100644
--- a/drivers/firmware/qcom_scm-64.c
+++ b/drivers/firmware/qcom_scm-64.c
@@ -57,9 +57,9 @@  static DEFINE_MUTEX(qcom_scm_lock);
 #define QCOM_SCM_EBUSY_MAX_RETRY 20
 
 #define SMCCC_FUNCNUM(s, c)	((((s) & 0xFF) << 8) | ((c) & 0xFF))
-#define SMCCC_N_EXT_ARGS 7
-#define SMCCC_FIRST_EXT_IDX 3
-#define SMCCC_N_REG_ARGS (MAX_QCOM_SCM_ARGS - SMCCC_N_EXT_ARGS + 1)
+#define SMCCC_N_REG_ARGS	4
+#define SMCCC_FIRST_EXT_IDX	(SMCCC_N_REG_ARGS - 1)
+#define SMCCC_N_EXT_ARGS	(MAX_QCOM_SCM_ARGS - SMCCC_N_REG_ARGS + 1)
 
 static void __qcom_scm_call_do_quirk(const struct qcom_scm_desc *desc,
 			       struct arm_smccc_res *res, u32 fn_id,