[PATCH] drm/ast: astdp: fix pre-op vs post-op bug

Thomas Zimmermann tzimmermann at suse.de
Fri Aug 9 13:24:35 UTC 2024


Hi,

thanks a lot for the bugfix.

Am 09.08.24 um 14:33 schrieb Dan Carpenter:
> The test for "Link training failed" expect the loop to exit with "i"
> set to zero but it exits when "i" is set to -1.  Change this from a
> post-op to a pre-op so that it exits with "i" set to zero.  This
> changes the number of iterations from 10 to 9 but probably that's
> okay.

Yes, that's ok.

>
> Fixes: 2281475168d2 ("drm/ast: astdp: Perform link training during atomic_enable")
> Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
> ---
>   drivers/gpu/drm/ast/ast_dp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_dp.c b/drivers/gpu/drm/ast/ast_dp.c
> index 5d07678b502c..4329ab680f62 100644
> --- a/drivers/gpu/drm/ast/ast_dp.c
> +++ b/drivers/gpu/drm/ast/ast_dp.c
> @@ -148,7 +148,7 @@ void ast_dp_link_training(struct ast_device *ast)
>   	struct drm_device *dev = &ast->base;
>   	unsigned int i = 10;
>   
> -	while (i--) {
> +	while (--i) {

If this loop ever starts with i = 0, it would break again. Can we use

while (i) {
   --i;
    ...
}

instead?

Best regards
Thomas

>   		u8 vgacrdc = ast_get_index_reg(ast, AST_IO_VGACRI, 0xdc);
>   
>   		if (vgacrdc & AST_IO_VGACRDC_LINK_SUCCESS)

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



More information about the dri-devel mailing list