From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9070B10E41D for ; Wed, 22 Mar 2023 23:04:08 +0000 (UTC) From: Ashutosh Dixit To: igt-dev@lists.freedesktop.org Date: Wed, 22 Mar 2023 16:04:01 -0700 Message-Id: <20230322230402.3342787-2-ashutosh.dixit@intel.com> In-Reply-To: <20230322230402.3342787-1-ashutosh.dixit@intel.com> References: <20230322230402.3342787-1-ashutosh.dixit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t 1/2] lib/igt_sysfs: Add i915_for_each_gt() macro List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: From: Zbigniew Kempczyński 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 Signed-off-by: Riana Tauro Signed-off-by: Ashutosh Dixit --- 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