[PATCH 1/6] drm/xe: Assert size of the struct xe_reg
Matt Roper
matthew.d.roper at intel.com
Wed Jan 17 23:21:32 UTC 2024
On Tue, Jan 16, 2024 at 03:56:12PM +0100, Michal Wajdeczko wrote:
> We want to keep the struct xe_reg as small as possible.
> Make sure we don't accidentally change its size.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> ---
> drivers/gpu/drm/xe/regs/xe_reg_defs.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/regs/xe_reg_defs.h b/drivers/gpu/drm/xe/regs/xe_reg_defs.h
> index c50e7650c09a..114b07db962f 100644
> --- a/drivers/gpu/drm/xe/regs/xe_reg_defs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_reg_defs.h
> @@ -6,6 +6,8 @@
> #ifndef _XE_REG_DEFS_H_
> #define _XE_REG_DEFS_H_
>
> +#include <linux/build_bug.h>
> +
> #include "compat-i915-headers/i915_reg_defs.h"
>
> /**
> @@ -44,6 +46,7 @@ struct xe_reg {
> u32 raw;
> };
> };
> +static_assert(sizeof(struct xe_reg) == sizeof(u32));
>
> /**
> * struct xe_reg_mcr - MCR register definition
> --
> 2.25.1
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list