struct mctelem_ent is opaque outside of mcetelem.c; the cookie abstraction exists - afaict - just to achieve this opaqueness. Then it is irrelevant though which kind of pointer mctelem_cookie_t resolves to. IOW we can as well use struct mctelem_ent there, allowing to remove the casts from COOKIE2MCTE() and MCTE2COOKIE(). Their removal addresses Misra C:2012 rule 11.2 ("Conversions shall not be performed between a pointer to an incomplete type and any other type") violations.
No functional change intended. Signed-off-by: Jan Beulich <jbeul...@suse.com> --- a/xen/arch/x86/cpu/mcheck/mctelem.c +++ b/xen/arch/x86/cpu/mcheck/mctelem.c @@ -64,8 +64,8 @@ struct mctelem_ent { #define MC_NENT (MC_URGENT_NENT + MC_NONURGENT_NENT) -#define COOKIE2MCTE(c) ((struct mctelem_ent *)(c)) -#define MCTE2COOKIE(tep) ((mctelem_cookie_t)(tep)) +#define COOKIE2MCTE(c) (c) +#define MCTE2COOKIE(tep) (tep) static struct mc_telem_ctl { /* Linked lists that thread the array members together. --- a/xen/arch/x86/cpu/mcheck/mctelem.h +++ b/xen/arch/x86/cpu/mcheck/mctelem.h @@ -52,7 +52,7 @@ * the element from the processing list. */ -typedef struct mctelem_cookie *mctelem_cookie_t; +typedef struct mctelem_ent *mctelem_cookie_t; typedef enum mctelem_class { MC_URGENT,