From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id E19576E817 for ; Wed, 30 Sep 2020 17:32:05 +0000 (UTC) From: Lyude Date: Wed, 30 Sep 2020 13:31:48 -0400 Message-Id: <20200930173150.431995-4-lyude@redhat.com> In-Reply-To: <20200930173150.431995-1-lyude@redhat.com> References: <20200930173150.431995-1-lyude@redhat.com> MIME-Version: 1.0 Subject: [igt-dev] [PATCH i-g-t v5 3/5] lib/igt_debugfs: Add igt_debugfs_pipe_dir() List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: igt-dev@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org List-ID: From: Lyude Paul Like igt_debugfs_connector_dir(), but for pipes instead. Changes since v4: * Make igt_debugfs_pipe_dir() much smaller - jcline * Fixup docs - jcline Signed-off-by: Lyude Paul --- lib/igt_debugfs.c | 21 +++++++++++++++++++++ lib/igt_debugfs.h | 1 + 2 files changed, 22 insertions(+) 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 diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index 722c5cc3..d43ba6c6 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -36,6 +36,7 @@ char *igt_debugfs_path(int device, char *path, int pathlen); int igt_debugfs_dir(int device); int igt_debugfs_connector_dir(int device, char *conn_name, int mode); +int igt_debugfs_pipe_dir(int device, int pipe, int mode); int igt_debugfs_open(int fd, const char *filename, int mode); void __igt_debugfs_read(int fd, const char *filename, char *buf, int size); -- 2.26.2 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev