From 8c54fc8efda832f6adef908d29e8865acb980aef Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 21 Aug 2026 16:39:23 +0200 Subject: [PATCH] drm/ast: Convert to atomic_create_state The ast crtc implementation provides a custom reset hook. However, this hook only allocates the state, initializes it with __drm_atomic_helper_crtc_reset(), and frees the previous state. It does not perform any hardware reset. Since this is exactly what the atomic_create_state hook is meant to do, minus the old state cleanup which the caller handles, convert the implementation to use atomic_create_state with __drm_atomic_helper_crtc_state_init() instead. Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20260821-drm-no-more-crtc-reset-v1-47-fb793475c05a@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/ast/ast_mode.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index d5ed8c5c7925..ea0ef8096aa9 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -888,17 +888,17 @@ static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = { .atomic_disable = ast_crtc_helper_atomic_disable, }; -static void ast_crtc_reset(struct drm_crtc *crtc) +static struct drm_crtc_state *ast_crtc_create_state(struct drm_crtc *crtc) { - struct ast_crtc_state *ast_state = kzalloc_obj(*ast_state); + struct ast_crtc_state *ast_state; - if (crtc->state) - crtc->funcs->atomic_destroy_state(crtc, crtc->state); + ast_state = kzalloc_obj(*ast_state); + if (!ast_state) + return ERR_PTR(-ENOMEM); - if (ast_state) - __drm_atomic_helper_crtc_reset(crtc, &ast_state->base); - else - __drm_atomic_helper_crtc_reset(crtc, NULL); + __drm_atomic_helper_crtc_state_init(&ast_state->base, crtc); + + return &ast_state->base; } static struct drm_crtc_state * @@ -934,7 +934,7 @@ static void ast_crtc_atomic_destroy_state(struct drm_crtc *crtc, } static const struct drm_crtc_funcs ast_crtc_funcs = { - .reset = ast_crtc_reset, + .atomic_create_state = ast_crtc_create_state, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip,