On Thu, Feb 13, 2025 at 7:34 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Use GLib conversion macros to pass misa_mxl_max as
> riscv_cpu_class_init() class data.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/cpu.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index f3ad7f88f0e..9fe1b23a297 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -2955,7 +2955,7 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
> {
> RISCVCPUClass *mcc = RISCV_CPU_CLASS(c);
>
> - mcc->misa_mxl_max = (RISCVMXL)(uintptr_t)data;
> + mcc->misa_mxl_max = (RISCVMXL)GPOINTER_TO_UINT(data);
> riscv_cpu_validate_misa_mxl(mcc);
> }
>
> @@ -3057,7 +3057,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> #define DEFINE_DYNAMIC_CPU(type_name, misa_mxl_max, initfn) \
> @@ -3066,7 +3066,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_DYNAMIC_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> #define DEFINE_VENDOR_CPU(type_name, misa_mxl_max, initfn) \
> @@ -3075,7 +3075,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_VENDOR_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> #define DEFINE_BARE_CPU(type_name, misa_mxl_max, initfn) \
> @@ -3084,7 +3084,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_BARE_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> #define DEFINE_PROFILE_CPU(type_name, misa_mxl_max, initfn) \
> @@ -3093,7 +3093,7 @@ void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename)
> .parent = TYPE_RISCV_BARE_CPU, \
> .instance_init = (initfn), \
> .class_init = riscv_cpu_class_init, \
> - .class_data = (void *)(misa_mxl_max) \
> + .class_data = GUINT_TO_POINTER(misa_mxl_max) \
> }
>
> static const TypeInfo riscv_cpu_type_infos[] = {
> --
> 2.47.1
>
>