summaryrefslogtreecommitdiff
path: root/lib/igt_sysfs.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2021-01-22 17:46:56 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2021-01-23 13:55:34 +0000
commit1b88d8993e0ac84f2f18490339b2cc2205b8b8a1 (patch)
tree08744615bf901ff59f44a5459f06fd528be0fa31 /lib/igt_sysfs.c
parent0949766cb9846d7d55fac9cdf31d3d8e8ed1d0c6 (diff)
i915: Exercise sysfs client properties
We store every client name, pid and runtime under sysfs. Better check that matches with the actual client. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Diffstat (limited to 'lib/igt_sysfs.c')
-rw-r--r--lib/igt_sysfs.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 6aafe534..e734143b 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -379,6 +379,42 @@ uint32_t igt_sysfs_get_u32(int dir, const char *attr)
}
/**
+ * igt_sysfs_get_u64:
+ * @dir: directory for the device from igt_sysfs_open()
+ * @attr: name of the sysfs node to open
+ *
+ * Convenience wrapper to read a unsigned 64bit integer from a sysfs file.
+ *
+ * Returns:
+ * The value read.
+ */
+uint64_t igt_sysfs_get_u64(int dir, const char *attr)
+{
+ uint64_t result;
+
+ if (igt_sysfs_scanf(dir, attr, "%"PRIu64, &result) != 1)
+ return 0;
+
+ return result;
+}
+
+/**
+ * igt_sysfs_set_u64:
+ * @dir: directory for the device from igt_sysfs_open()
+ * @attr: name of the sysfs node to open
+ * @value: value to set
+ *
+ * Convenience wrapper to write a unsigned 64bit integer to a sysfs file.
+ *
+ * Returns:
+ * True if successfully written
+ */
+bool igt_sysfs_set_u64(int dir, const char *attr, uint64_t value)
+{
+ return igt_sysfs_printf(dir, attr, "%"PRIu64, value) > 0;
+}
+
+/**
* igt_sysfs_set_u32:
* @dir: directory for the device from igt_sysfs_open()
* @attr: name of the sysfs node to open