[igt-dev] [PATCH i-g-t 1/2] lib/igt_sysfs: Add i915_for_each_gt() macro
Kamil Konieczny
kamil.konieczny at linux.intel.com
Thu Mar 23 13:28:16 UTC 2023
On 2023-03-22 at 16:04:01 -0700, Ashutosh Dixit wrote:
> From: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
>
> Add a macro to iterate over all the gts
>
> v2: s/for_each_gt/i915_for_each_gt/ because of introduction of
> xe_for_each_gt
>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Signed-off-by: Riana Tauro <riana.tauro at intel.com>
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
> lib/igt_sysfs.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
> index 2e3c4813adc..c0fcf6b5739 100644
> --- a/lib/igt_sysfs.h
> +++ b/lib/igt_sysfs.h
> @@ -38,6 +38,11 @@
> (dirfd__ = igt_sysfs_gt_open(i915__, gt__)) != -1; \
> close(dirfd__), gt__++)
>
> +#define i915_for_each_gt(i915, gtid, dir) \
> + for ((gtid) = 0; \
> + ((dir) = igt_sysfs_gt_open((i915), (gtid))) != -1; \
> + close(dir), (gtid)++)
> +
> #define igt_sysfs_rps_write(dir, id, data, len) \
> igt_sysfs_write(dir, igt_sysfs_dir_id_to_name(dir, id), data, len)
>
> --
> 2.38.0
>
More information about the igt-dev
mailing list