[PATCH 1/2] gpu: drm: ast: Replace mdelay with msleep in reset_mmc_2500

Jia-Ju Bai baijiaju1990 at gmail.com
Wed Apr 11 08:29:36 UTC 2018


reset_mmc_2500() is never called in atomic context.

The call chains ending up at reset_mmc_2500() are:
[1] reset_mmc_2500() <- ast_dram_init_2500() <- ast_post_chip_2500() <- 
	ast_post_gpu() <- ast_drm_thaw()
[2] reset_mmc_2500() <- ast_dram_init_2500() <- ast_post_chip_2500() <- 
	ast_post_gpu() <- ast_driver_load()

ast_drm_thaw() calls console_lock() which can sleep.
ast_driver_load() is set as ".load" in struct drm_driver.
These functions are not called in atomic context.

Despite never getting called from atomic context, reset_mmc_2500()
calls mdelay() to busily wait.
This is not necessary and can be replaced with msleep() to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990 at gmail.com>
---
 drivers/gpu/drm/ast/ast_post.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index f7d4213..12bbf64 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -1840,7 +1840,7 @@ static void reset_mmc_2500(struct ast_private *ast)
 	ast_moutdwm(ast, 0x1E785044, 0x00000001);
 	ast_moutdwm(ast, 0x1E785048, 0x00004755);
 	ast_moutdwm(ast, 0x1E78504C, 0x00000013);
-	mdelay(100);
+	msleep(100);
 	ast_moutdwm(ast, 0x1E785054, 0x00000077);
 	ast_moutdwm(ast, 0x1E6E0000, 0xFC600309);
 }
-- 
1.9.1



More information about the dri-devel mailing list