Skip to contentSkip to conversation

lib: fix igt_reset_connectors

PATCH In review Thomas Wood 2 participants 2 messages Nov 24, 2014 – Nov 25, 2014 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: fix igt_reset_connectors

Use igt_debugfs_open to open the connector file, since the forced_connectors array now only stores the connector path relative to the debugfs path. Also add some extra error checking to ensure a test failure if the reset fails.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85829

---
 lib/igt_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/igt_kms.c +2 -2
index 5edd5ec..cba0c27 100644
@@ -1773,8 +1773,8 @@ void igt_reset_connectors(void)
 	 * functions that are not safe to call in signal handlers */
 
 	for (tmp = forced_connectors; *tmp; tmp++) {
-		int fd = open(*tmp, O_WRONLY | O_TRUNC);
-		write(fd, "unspecified", 11);
+		int fd = igt_debugfs_open(*tmp, O_WRONLY | O_TRUNC);
+		igt_assert(write(fd, "unspecified", 11) == 11);
 		close(fd);
 	}
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by lu hua on v1 1/1
#1 lore raw
Quoted 7 lines · Thomas Wood

Use igt_debugfs_open to open the connector file, since the forced_connectors array now only stores the connector path relative to the debugfs path. Also add some extra error checking to ensure a test failure if the reset fails.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85829

And I went right ahead and committed it, thanks.
-Daniel

Quoted 26 lines
---
 lib/igt_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/igt_kms.c +2 -2
index 5edd5ec..cba0c27 100644
@@ -1773,8 +1773,8 @@ void igt_reset_connectors(void)
 	 * functions that are not safe to call in signal handlers */
 
 	for (tmp = forced_connectors; *tmp; tmp++) {
-		int fd = open(*tmp, O_WRONLY | O_TRUNC);
-		write(fd, "unspecified", 11);
+		int fd = igt_debugfs_open(*tmp, O_WRONLY | O_TRUNC);
+		igt_assert(write(fd, "unspecified", 11) == 11);
 		close(fd);
 	}
 }
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx