summaryrefslogtreecommitdiff
path: root/lib/igt_sysfs.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-07-22 12:58:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-07-22 14:27:43 +0100
commitc6e26e47e139ba38fd746daa36ca982908b46840 (patch)
treeb9480774cb75b1a011bcc5d5c17d959a6ec5923a /lib/igt_sysfs.c
parent5d233babe7a99467c658e18c9091f4475dfd5b06 (diff)
igt/gem_exec_nop: Display submission mechanism
Useful for confirmation when testing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_sysfs.c')
-rw-r--r--lib/igt_sysfs.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 61b94c64..1cf7f710 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -119,6 +119,29 @@ int igt_sysfs_open(int fd, int *idx)
}
/**
+ * igt_sysfs_open_parameters:
+ * @device: fd of the device (or -1 to default to Intel)
+ *
+ * This opens the module parameters directory (under sysfs) corresponding
+ * to the device for use with igt_sysfs_set() and igt_sysfs_get().
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_sysfs_open_parameters(int fd)
+{
+ int dir, params;
+
+ dir = igt_sysfs_open(fd, &params);
+ if (dir < 0)
+ return -1;
+
+ params = openat(dir, "device/driver/module/parameters", O_RDONLY);
+ close(dir);
+
+ return params;
+}
+/**
* igt_sysfs_set:
* @dir: directory for the device from igt_sysfs_open()
* @attr: name of the sysfs node to open