drm/sitronix: st7920: Convert to atomic_create_state

The st7920 crtc implementation provides a custom reset hook. However,
this hook only allocates the state, initializes it with
__drm_atomic_helper_crtc_reset(), and warns if there's a 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 <tzimmermann@suse.de>
Reviewed-by: Iker Pedrosa <ikerpedrosam@gmail.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/r/20260904-drm-no-more-crtc-reset-v3-11-27d9891512ce@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
Maxime Ripard 2026-09-04 11:07:29 +02:00
parent c60095d8cd
commit 18740b7fe4
No known key found for this signature in database
GPG Key ID: 275FCE19A23DBE76

View File

@ -575,17 +575,17 @@ static void st7920_crtc_atomic_disable(struct drm_crtc *crtc,
}
/* Called during init to allocate the CRTC's atomic state. */
static void st7920_crtc_reset(struct drm_crtc *crtc)
static struct drm_crtc_state *st7920_crtc_create_state(struct drm_crtc *crtc)
{
struct st7920_crtc_state *st7920_state;
drm_WARN_ON_ONCE(crtc->dev, crtc->state);
st7920_state = kzalloc_obj(*st7920_state);
if (!st7920_state)
return;
return ERR_PTR(-ENOMEM);
__drm_atomic_helper_crtc_reset(crtc, &st7920_state->base);
__drm_atomic_helper_crtc_state_init(&st7920_state->base, crtc);
return &st7920_state->base;
}
static struct drm_crtc_state *st7920_crtc_duplicate_state(struct drm_crtc *crtc)
@ -629,7 +629,7 @@ static const struct drm_crtc_helper_funcs st7920_crtc_helper_funcs = {
};
static const struct drm_crtc_funcs st7920_crtc_funcs = {
.reset = st7920_crtc_reset,
.atomic_create_state = st7920_crtc_create_state,
.destroy = drm_crtc_cleanup,
.set_config = drm_atomic_helper_set_config,
.page_flip = drm_atomic_helper_page_flip,