public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: igt-dev@lists.freedesktop.org, daniel.vetter@ffwll.ch
Subject: [igt-dev] [PATCH i-g-t v5 1/2] lib/debugfs: function to open connector debugfs dir
Date: Mon, 22 Oct 2018 22:35:39 +0530	[thread overview]
Message-ID: <1540227940-3064-1-git-send-email-ramalingam.c@intel.com> (raw)

Function to open a debugfs directory of a connector associated to
a device.

v2:
  instead of string manipulation openat used [Chris]

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 lib/igt_debugfs.c | 27 +++++++++++++++++++++++++++
 lib/igt_debugfs.h |  1 +
 2 files changed, 28 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index baedc2255ac9..181e2cfc114f 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -237,6 +237,33 @@ int igt_debugfs_dir(int device)
 }
 
 /**
+ * igt_debugfs_connector_dir:
+ * @device: fd of the device
+ * @conn_name: conenctor name
+ * @mode: mode bits as used by open()
+ *
+ * This opens the debugfs directory corresponding to connector on the device
+ * for use with igt_sysfs_get() and related functions.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_connector_dir(int device, char *conn_name, int mode)
+{
+	int dir, ret;
+
+	dir = igt_debugfs_dir(device);
+	if (dir < 0)
+		return dir;
+
+	ret = openat(dir, conn_name, mode);
+
+	close(dir);
+
+	return ret;
+}
+
+/**
  * igt_debugfs_open:
  * @filename: name of the debugfs node to open
  * @mode: mode bits as used by open()
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index ff8612dc66c2..8349ce948d49 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -35,6 +35,7 @@ const char *igt_debugfs_mount(void);
 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_open(int fd, const char *filename, int mode);
 void __igt_debugfs_read(int fd, const char *filename, char *buf, int size);
-- 
2.7.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2018-10-22 17:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 17:05 Ramalingam C [this message]
2018-10-22 17:05 ` [igt-dev] [PATCH i-g-t v5 2/2] kms_content_protection: Add Content Protection test Ramalingam C
2018-10-22 22:45 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,v5,1/2] lib/debugfs: function to open connector debugfs dir Patchwork
2018-10-23  5:49   ` C, Ramalingam
2018-10-23 13:33     ` Daniel Vetter
2018-10-23  6:24 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2018-10-23  7:29 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-10-23  7:42 ` Patchwork
2018-10-23 12:41 ` [igt-dev] ✓ Fi.CI.BAT: " Patchwork
2018-10-23 12:59 ` Patchwork
2018-10-23 15:44 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=1540227940-3064-1-git-send-email-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --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