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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux