public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] lib/i915: Use explicit iterator names in for_each_engine()
Date: Sat, 26 Oct 2019 20:39:23 +0300	[thread overview]
Message-ID: <20191026173923.GA10452@intel.intel> (raw)
In-Reply-To: <20191025142333.11806-1-chris@chris-wilson.co.uk>

Hi Chris,

I thought we wanted to keep the warnings as a reminder until we
removed the legacy foreach :)

[...]

> diff --git a/lib/igt_gt.h b/lib/igt_gt.h
> index 73b5002a0..66088d391 100644
> --- a/lib/igt_gt.h
> +++ b/lib/igt_gt.h
> @@ -72,19 +72,21 @@ extern const struct intel_execution_engine {
>  	unsigned flags;
>  } intel_execution_engines[];
>  
> +#define eb_ring(e) ((e)->exec_id | (e)->flags)
> +
>  #define for_if(expr__) if (!(expr__)) {} else
>  
> -#define for_each_engine(fd__, flags__) \
> -	for (const struct intel_execution_engine *e__ = intel_execution_engines;\
> -	     e__->name; \
> -	     e__++) \
> -		for_if (gem_has_ring(fd__, flags__ = e__->exec_id | e__->flags))
> -
> -#define for_each_physical_engine(fd__, flags__) \
> -	for (const struct intel_execution_engine *e__ = intel_execution_engines;\
> -	     e__->name; \
> -	     e__++) \
> -		for_if (gem_ring_has_physical_engine(fd__, flags__ = e__->exec_id | e__->flags))
> +#define for_each_engine(it__, fd__) \
> +	for (const struct intel_execution_engine *it__ = intel_execution_engines;\
> +	     it__->name; \
> +	     it__++) \
> +		for_if (gem_has_ring(fd__, eb_ring(it__)))
> +
> +#define for_each_physical_engine(it__, fd__) \
> +	for (const struct intel_execution_engine *it__ = intel_execution_engines;\
> +	     it__->name; \
> +	     it__++) \
> +		for_if (gem_ring_has_physical_engine(fd__, eb_ring(it__)))

(we already talked once about this) it makes more sense to me the
iterator to be declared outside the from loop in order to not keep
it hidden from the user.

It's also to be consistent with all the rest of the iterations,
starting from the 'for()'.

Nevertheless, I think this code is going to disappear somedays,
so that:

Acked-by: Andi Shyti <andi.shyti@intel.com>

Thanks,
Andi
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-10-26 17:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 14:23 [igt-dev] [PATCH i-g-t] lib/i915: Use explicit iterator names in for_each_engine() Chris Wilson
2019-10-25 15:28 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2019-10-25 15:33 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2019-10-25 16:24 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/i915: Use explicit iterator names in for_each_engine() (rev2) Patchwork
2019-10-25 16:28 ` [igt-dev] [PATCH i-g-t] lib/i915: Use explicit iterator names in for_each_engine() Chris Wilson
2019-10-25 16:54 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/i915: Use explicit iterator names in for_each_engine() (rev3) Patchwork
2019-10-26 17:39 ` Andi Shyti [this message]
2019-10-26 17:55   ` [igt-dev] [PATCH i-g-t] lib/i915: Use explicit iterator names in for_each_engine() Chris Wilson
2019-10-27  6:52 ` [igt-dev] ✗ Fi.CI.IGT: failure for lib/i915: Use explicit iterator names in for_each_engine() (rev3) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191026173923.GA10452@intel.intel \
    --to=andi.shyti@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox