[PATCH v3 14/18] smccc: Cast arguments to unsigned long
Marc Zyngier
maz at kernel.org
Mon Sep 7 09:33:17 EDT 2020
On Thu, 03 Sep 2020 14:53:03 +0100,
Andrew Scull <ascull at google.com> wrote:
>
> To avoid warning about implicit casting, make the casting explicit. This
> allows, for example, pointers to be used as arguments as are used in the
> KVM hyp interface.
>
> Cc: Sudeep Holla <sudeep.holla at arm.com>
> Signed-off-by: Andrew Scull <ascull at google.com>
> ---
> include/linux/arm-smccc.h | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> index 15c706fb0a37..3bb109a35554 100644
> --- a/include/linux/arm-smccc.h
> +++ b/include/linux/arm-smccc.h
> @@ -260,7 +260,7 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
> typeof(a1) __a1 = a1; \
> struct arm_smccc_res *___res = res; \
> register unsigned long r0 asm("r0") = (u32)a0; \
> - register unsigned long r1 asm("r1") = __a1; \
> + register unsigned long r1 asm("r1") = (unsigned long)__a1; \
Given the pain we go through to extract the type of each argument, it
seems odd to end-up with casts everywhere. I'd rather keep the type
system alive by having:
register typeof(a1) r1 asm("r1") = __a1;
Is there any reason why this doesn't work?
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list