[Intel-gfx] [PATCH] drm/i915/gt: Remove assignment from if condition

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Thu Oct 26 14:37:29 UTC 2023


On 26/10/2023 14:58, Gilbert Adikankwu wrote:
> Initialize variable "entry" during declaration. Remove assignment from if
> condition.
> 
> Fix checkpatch.pl error:
> ERROR: do not use assignment in if condition
> 
> Signed-off-by: Gilbert Adikankwu <gilbertadikankwu at gmail.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
> index e8f42ec6b1b4..cbc4ecf26d8b 100644
> --- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
> +++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
> @@ -1751,7 +1751,7 @@ static bool gen8_csb_parse(const u64 csb)
>   static noinline u64
>   wa_csb_read(const struct intel_engine_cs *engine, u64 * const csb)
>   {
> -	u64 entry;
> +	u64 entry = READ_ONCE(*csb);
>   
>   	/*
>   	 * Reading from the HWSP has one particular advantage: we can detect
> @@ -1763,7 +1763,7 @@ wa_csb_read(const struct intel_engine_cs *engine, u64 * const csb)
>   	 * tgl,dg1:HSDES#22011327657
>   	 */
>   	preempt_disable();
> -	if (wait_for_atomic_us((entry = READ_ONCE(*csb)) != -1, 10)) {
> +	if (wait_for_atomic_us(entry != -1, 10)) {

Wait_for_atomic_us is a macro which needs to keep reading the csb until 
it changes so this will not work.

Regards,

Tvrtko

>   		int idx = csb - engine->execlists.csb_status;
>   		int status;
>   


More information about the Intel-gfx mailing list