Hi Jan,

Jan Beulich <[email protected]> writes:

> Outside of drivers/acpi/tables/ (which is excluded from Eclair reporting
> for dubious reasons), arch/arm/acpi/domain_build.c is the only user of
> ACPI_COMPARE_NAME(). Make the macro const correct, at the expense of
> introducing a "const" variant of ACPI_CAST_PTR(), and at the expense of

I think you can avoid adding ACPI_CAST_PTR() by providing a const
type. Like this:

+#define ACPI_COMPARE_NAME(a, b)         (*ACPI_CAST_PTR (const u32, a) == \
+                                         *ACPI_CAST_PTR (const u32, b))


> altering an imported file.
>
> No functional change intended.
>
> Signed-off-by: Jan Beulich <[email protected]>
>
> --- a/xen/include/acpi/acmacros.h
> +++ b/xen/include/acpi/acmacros.h
> @@ -103,6 +103,7 @@
>   * Pointer manipulation
>   */
>  #define ACPI_CAST_PTR(t, p)             ((t *) (acpi_uintptr_t) (p))
> +#define ACPI_CAST_CPTR(t, p)            ((const t *) (const acpi_uintptr_t) 
> (p))
>  #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (acpi_uintptr_t) (p))
>  #define ACPI_ADD_PTR(t,a,b)             ACPI_CAST_PTR (t, (ACPI_CAST_PTR 
> (u8,(a)) + (acpi_native_uint)(b)))
>  #define ACPI_PTR_DIFF(a,b)              (acpi_native_uint) (ACPI_CAST_PTR 
> (u8,(a)) - ACPI_CAST_PTR (u8,(b)))
> @@ -116,9 +117,12 @@
>  #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
>  
>  #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
> -#define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (u32,(a)) == 
> *ACPI_CAST_PTR (u32,(b)))
> +#define ACPI_COMPARE_NAME(a, b)         (*ACPI_CAST_CPTR (u32, a) == \
> +                                         *ACPI_CAST_CPTR (u32, b))
>  #else
> -#define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR 
> (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE))
> +#define ACPI_COMPARE_NAME(a, b)         (!ACPI_STRNCMP (ACPI_CAST_CPTR 
> (char, a), \
> +                                                        ACPI_CAST_CPTR 
> (char, b), \
> +                                                        ACPI_NAME_SIZE))
>  #endif
>  
>  /*

-- 
WBR, Volodymyr

Reply via email to