[igt-dev] [PATCH i-g-t v1 2/3] tests/testdisplay: Use igt_parse_mode_string for command line arguments

Rohith Iyer quic_rohiiyer at quicinc.com
Wed Jul 13 22:22:34 UTC 2022


Use igt_parse_mode_string instead of sscanf to parse mode string from command line.

Signed-off-by: Rohith Iyer <quic_rohiiyer at quicinc.com>
---
 tests/testdisplay.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index e9fbd260..4db182b4 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -625,8 +625,6 @@ static const char *help_str =
 
 static int opt_handler(int opt, int opt_index, void *data)
 {
-	float force_clock;
-
 	switch (opt) {
 	case '3':
 		test_stereo_modes = 1;
@@ -642,12 +640,8 @@ static int opt_handler(int opt, int opt_index, void *data)
 		break;
 	case 'f':
 		force_mode = 1;
-		if (sscanf(optarg,"%f,%hu,%hu,%hu,%hu,%hu,%hu,%hu,%hu",
-			   &force_clock,&force_timing.hdisplay, &force_timing.hsync_start,&force_timing.hsync_end,&force_timing.htotal,
-			   &force_timing.vdisplay, &force_timing.vsync_start, &force_timing.vsync_end, &force_timing.vtotal)!= 9)
+		if (!igt_parse_mode_string(optarg, &force_timing))
 			return IGT_OPT_HANDLER_ERROR;
-		force_timing.clock = force_clock*1000;
-
 		break;
 	case 's':
 		sleep_between_modes = atoi(optarg);
-- 
2.31.0



More information about the igt-dev mailing list