<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix">On 10/22/2018 8:28 PM, Chris Wilson
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:154022033346.18004.2527162657381368877@skylake-alporthouse-com">
<pre class="moz-quote-pre" wrap="">Quoting Ramalingam C (2018-10-22 15:23:48)
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Function to open a debugfs director of a connector associated to
a device.
Signed-off-by: Ramalingam C <a class="moz-txt-link-rfc2396E" href="mailto:ramalingam.c@intel.com"><ramalingam.c@intel.com></a>
---
lib/igt_debugfs.c | 24 ++++++++++++++++++++++++
lib/igt_debugfs.h | 1 +
2 files changed, 25 insertions(+)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index baedc2255ac9..f545e8a3eec9 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -237,6 +237,30 @@ int igt_debugfs_dir(int device)
}
/**
+ * igt_debugfs_connector_dir:
+ * @device: fd of the device
+ * @conn_name: conenctor name
+ *
+ * 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)
+{
+ char path[200], base_path[200];
+
+ if (!igt_debugfs_path(device, base_path, sizeof(base_path)))
+ return -1;
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Why not use the debugfs_dir and openat? String ops not required.</pre>
</blockquote>
<pre>Chris,
</pre>
<pre>Do you mean this way?
</pre>
<pre>int igt_debugfs_connector_dir(int device, char *conn_name)
{
int dir, ret;
dir = igt_debugfs_dir(device);
if (dir < 0)
return dir;
ret = openat(dir, conn_name, O_RDONLY);
close(dir);
return ret;
}
</pre>
<pre>--Ram
</pre>
<blockquote type="cite"
cite="mid:154022033346.18004.2527162657381368877@skylake-alporthouse-com">
<pre class="moz-quote-pre" wrap="">
-Chris
</pre>
</blockquote>
</body>
</html>