[Intel-gfx] [RFC] drm/i915/uc: Log fw status changes only under debug config

Chris Wilson chris at chris-wilson.co.uk
Mon Aug 12 20:08:59 UTC 2019


Quoting Michal Wajdeczko (2019-08-12 20:51:25)
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h
> index 20a5ddb753c3..885a4d7e4d37 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h
> @@ -42,7 +42,7 @@ enum intel_uc_fw_type {
>   */
>  struct intel_uc_fw {
>         enum intel_uc_fw_type type;
> -       enum intel_uc_fw_status status;
> +       enum intel_uc_fw_status _status;

What you can do to prevent accidentally writing into the variable, while
keeping fw->status for convenience, is

-       enum intel_uc_fw_status _status;
+       union {
+               const enum intel_uc_fw_status status;
+               enum intel_uc_fw_status __status; /* no accidental overwrites */
+       };

The only catch is that is disallows struct assignment (but memcpy is
still fine).
-Chris


More information about the Intel-gfx mailing list