Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/2] lib/igt_sysfs: Add i915_for_each_gt() macro
Date: Wed, 22 Mar 2023 16:04:01 -0700	[thread overview]
Message-ID: <20230322230402.3342787-2-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20230322230402.3342787-1-ashutosh.dixit@intel.com>

From: Zbigniew Kempczyński <zbigniew.kempczynski@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@intel.com>
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@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

  reply	other threads:[~2023-03-22 23:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 23:04 [igt-dev] [PATCH i-g-t 0/2] i915/i915_power: Also show requested and actual freq's Ashutosh Dixit
2023-03-22 23:04 ` Ashutosh Dixit [this message]
2023-03-23 13:28   ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_sysfs: Add i915_for_each_gt() macro Kamil Konieczny
2023-03-22 23:04 ` [igt-dev] [PATCH i-g-t 2/2] i915/i915_power: Also show requested and actual freq's Ashutosh Dixit
2023-03-23  5:03   ` Riana Tauro
2023-03-22 23:34 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/i915_power: Also show requested and actual freq's (rev2) Patchwork
2023-03-23  0:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-03-23 18:19 ` [igt-dev] [PATCH i-g-t 0/2] i915/i915_power: Also show requested and actual freq's Dixit, Ashutosh

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=20230322230402.3342787-2-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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