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

Abhinav Kumar quic_abhinavk at quicinc.com
Thu Aug 4 20:37:05 UTC 2022



On 7/29/2022 5:35 PM, Rohith Iyer wrote:
> Use igt_parse_mode_string instead of sscanf to parse mode string from command line.
> 
> Reviewed-by: Petri Latvala <petri.latvala at intel.com>
> Signed-off-by: Rohith Iyer <quic_rohiiyer at quicinc.com>

LGTM,

Reviewed-by: Abhinav Kumar <quic_abhinavk 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);


More information about the igt-dev mailing list