From ec1049f66df4751e87c036cd2e45a38a7649d8af Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Tue, 2 Sep 2025 10:32:49 +0200 Subject: [PATCH] drm/tidss: crtc: Implement destroy_state The tidss crtc driver implements its own state, with its own implementation of reset and duplicate_state, but uses the default destroy_state helper. This somewhat works for now because the drm_crtc_state field in tidss_crtc_state is the first field so the offset is 0, but it's pretty fragile and it should really have its own destroy_state implementation. Reviewed-by: Thomas Zimmermann Link: https://lore.kernel.org/r/20250902-drm-state-readout-v1-21-14ad5315da3f@kernel.org Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20250902-drm-state-readout-v1-21-14ad5315da3f@kernel.org --- drivers/gpu/drm/tidss/tidss_crtc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c index db7c5e4225e62..eb431a238b11d 100644 --- a/drivers/gpu/drm/tidss/tidss_crtc.c +++ b/drivers/gpu/drm/tidss/tidss_crtc.c @@ -343,6 +343,15 @@ static void tidss_crtc_disable_vblank(struct drm_crtc *crtc) tidss_runtime_put(tidss); } +static void tidss_crtc_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + struct tidss_crtc_state *tstate = to_tidss_crtc_state(state); + + __drm_atomic_helper_crtc_destroy_state(&tstate->base); + kfree(tstate); +} + static void tidss_crtc_reset(struct drm_crtc *crtc) { struct tidss_crtc_state *tstate; @@ -398,7 +407,7 @@ static const struct drm_crtc_funcs tidss_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .atomic_duplicate_state = tidss_crtc_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .atomic_destroy_state = tidss_crtc_destroy_state, .enable_vblank = tidss_crtc_enable_vblank, .disable_vblank = tidss_crtc_disable_vblank, }; -- 2.47.3