From 30032a72d441651b36cf73b751fed9b2e3165e8f Mon Sep 17 00:00:00 2001 From: Lyude Paul Date: Wed, 30 Sep 2020 13:31:48 -0400 Subject: lib/igt_debugfs: Add igt_debugfs_pipe_dir() Like igt_debugfs_connector_dir(), but for pipes instead. Changes since v4: * Make igt_debugfs_pipe_dir() much smaller - jcline * Fixup docs - jcline Reviewed-by: Jeremy Cline Signed-off-by: Lyude Paul --- lib/igt_debugfs.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/igt_debugfs.c') diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 05067078..c4dab392 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -260,6 +260,27 @@ int igt_debugfs_connector_dir(int device, char *conn_name, int mode) return ret; } +/** + * igt_debugfs_pipe_dir: + * @device: fd of the device + * @pipe: index of pipe + * @mode: mode bits as used by open() + * + * This opens the debugfs directory corresponding to the pipe index on the + * device for use with igt_sysfs_get() and related functions. This is just + * syntax sugar for igt_debugfs_open(). + * + * Returns: + * The directory fd, or -1 on failure. + */ +int igt_debugfs_pipe_dir(int device, int pipe, int mode) +{ + char buf[128]; + + snprintf(buf, sizeof(buf), "crtc-%d", pipe); + return igt_debugfs_open(device, buf, mode); +} + /** * igt_debugfs_open: * @filename: name of the debugfs node to open -- cgit v1.2.3